解决Appium无元素可选的如何定位(java篇)

1、首先我们看看要定位的东西,我要定位的就是折让率上图自己看

写代码:
 
AndroidElement element = driver.findElementByAndroidUIAutomator("new UiSelector().className("android.widget.LinearLayout")");//先获取到该元素
int b = 9;//要滑动几次才能找到该值,自己掂量
while(b>0){
Thread.sleep(2000);
int x = element.getSize().width;//元素的宽1080
int y = element.getLocation().getY();//元素起始点y
int h =element.getSize().height;//元素的高
driver.swipe(x/2, y+h/10*4, x/2, y+h/10*3, 300);//根据坐标点来滑动
b--;
}
Thread.sleep(2000);
driver.findElementByAndroidUIAutomator("new UiSelector().resourceId("com.dsf.app:id/img_select")").click();//点击勾
原文地址:https://www.cnblogs.com/zqinghua/p/6645990.html