[英]How to end the scroll action using appium driver in jav?
我不知道如何結束滾動動作,如果存在特定的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); }
您可以使用Xpath在該頁面/層次結構上定位最后一個對象。 到最后一個元素的xpath可以生成為-
(“ Your_Object_Xpath”)[1] /../* [last()]
將此對象的可見性作為滾動循環的break參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.