[英]How to end the scroll action using appium driver in jav?
I don't know how to end the scroll action, if particular web element is present means, I need to end the scroll action. 我不知道如何结束滚动动作,如果存在特定的Web元素,则需要结束滚动动作。
while(AppiumHelper.isElementPresent(driver,By.name("Comment")) == false){ System.out.println("1......"); WebElement element = driver .findElementByName("save_button"); JavascriptExecutor js = (JavascriptExecutor) driver; HashMap<String, String> scrollObjects = new HashMap<String, String>(); scrollObjects.put("direction", "down"); scrollObjects.put("element", ((RemoteWebElement) element).getId()); js.executeScript("mobile: scroll", scrollObjects); }
You can use Xpath for locating the last object on that page/hierarchy. 您可以使用Xpath在该页面/层次结构上定位最后一个对象。 The xpath to last element can be generated like-
到最后一个元素的xpath可以生成为-
("Your_Object_Xpath")[1]/../*[last()] (“ Your_Object_Xpath”)[1] /../* [last()]
Give this object's visibility as a break parameter for your scrolling loop. 将此对象的可见性作为滚动循环的break参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.