- I am writing automation test case for iOS app using appium and java.I need to do scroll action, I have tried with below code for scroll action.
- I need to scroll till the particular web element and then i need to assert that particular element.
- Below code scroll till the end of the page, after it reached to the end of the page, it tries to scroll down, so it throws error message.
- I don’t know how to end the scroll action, if particular web element is present means, I need to end the scroll action.
code:-
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);
}