Appium uiAutomator在android上运行良好,但在iOS上运行不好
我尝试使用以下代码滚动到某个元素: @AndroidFindByuiAutomator=new-UIScrollAllableNew-UiSelector.scrollIntoView+new-UiSelector.text\Contacts\; @iOSFindByuiAutomator=new-UiScrollablenew-UiSelector.scrollIntoView+new-UiSelector.text\Contacts\; 公共移动联络 这在安卓系统中非常有效,但在iOS上,我遇到以下错误: org.openqa.selenium.NoSuchElementException:无法通过此策略定位元素:定位器映射: -本机内容:By.IosUIAutomation:new-UIScrolllablenew-UiSelector.scrollIntoViewnew-UiSelector.textContacts 我还尝试使用以下方式滚动: 公共无效垂直滚动AppIUMDriver驱动程序{Appium uiAutomator在android上运行良好,但在iOS上运行不好,appium,appium-ios,Appium,Appium Ios,我尝试使用以下代码滚动到某个元素: @AndroidFindByuiAutomator=new-UIScrollAllableNew-UiSelector.scrollIntoView+new-UiSelector.text\Contacts\; @iOSFindByuiAutomator=new-UiScrollablenew-UiSelector.scrollIntoView+new-UiSelector.text\Contacts\; 公共移动联络 这在安卓系统中非常有效,但在iOS上,我
this.driver=driver;
dimensions = driver.manage().window().getSize();
Double screenHeightStart = dimensions.getHeight() * 0.5;
int scrollStart = screenHeightStart.intValue();
System.out.println("s="+scrollStart);
Double screenHeightEnd = dimensions.getHeight() * 0.2;
int scrollEnd = screenHeightEnd.intValue();
driver.swipe(0,scrollStart,0,scrollEnd,5000);
}
但它也不起作用。
谁能告诉我我做错了什么吗
你的代码不起作用的原因是,你在@iOSFindBy上也使用了Android定位器策略,这是错误的,非常错误的
根据您的Xcode版本,您可能无法在Xcode 8中的iOS上使用UiAutomator。apple已删除此选项
您必须使用ID/Accessibility-ID甚至Xpath。请花些时间研究定位器策略,搜索示例以及如何正确查找iOS元素
我无法提供更多的帮助,因为我不熟悉您尝试自动化的应用程序。这个元素有ID吗?是可见还是必须滚动才能找到?你知道如何使用driver.findBy吗