【发布时间】:2017-08-20 05:27:37
【问题描述】:
我正在尝试使用以下代码滚动到一个元素:
@AndroidFindBy(uiAutomator="new UiScrollable(new UiSelector()).scrollIntoView(" + "new UiSelector().text(\"Contacts\"));") @iOSFindBy(uiAutomator="new UiScrollable(new UiSelector()).scrollIntoView(" + "new UiSelector().text(\"Contacts\"));") 公共 MobileElement orgContact;
这在 Android 上完美运行,但在 iOS 上我收到以下错误: org.openqa.selenium.NoSuchElementException:无法通过此策略定位元素:定位器映射: - 原生内容:“By.IosUIAutomation: new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().text("Contacts"));”
我也尝试使用以下方式滚动: 公共无效垂直滚动(AppiumDriver驱动程序){
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);
} 但它也不起作用。 谁能建议我在这里做错了什么
【问题讨论】:
标签: appium appium-ios