如何解决滚动到在appium驱动程序中不起作用的元素
滚动到在 appium 驱动程序中不起作用的元素。 是否有任何与
类似的javascript ((JavascriptExecutor) getWebDriver()).executeScript("arguments[0].scrollIntoView();",getWebDriver().findElement(locator));
用于webdriver。 我们正在使用
driver.context("WEBVIEW_" + applicationId);
代替 uiautomator 。
有帮助吗?
解决方法
您可以在appium中使用touchActions进行这样的滚动:
TouchActions action = new TouchActions(driver);
action.scroll(element,10,100);
action.perform();
或使用对2个元素的引用作为:
TouchAction().press(el0).moveTo(el1).release();
,
您可以使用以下代码。
((FindsByAndroidUIAutoamtor<?>)(driver).find_element_by_android_uiautomator('new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains("**Expected text**").instance(0))');
有关uiautomators的更多信息,请参见https://developer.android.com/reference/androidx/test/uiautomator/UiScrollable
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。