简体   繁体   中英

Scrolling is not working properly in IOS appium

Scrolling is not working properly in IOS appium..Below code scrolls a bit but gets stopped in between and does not reach on bottom of the page.

I used below code:

JavascriptExecutor js = (JavascriptExecutor) driver; 
HashMap scrollObject = new HashMap(); 
scrollObject.put("direction", "up"); 
scrollObject.put("xpath", "//XCUIElementTypeStaticText[@name=\"NAME\"]");
js.executeScript("mobile: swipe", scrollObject);

You will need to scroll a few times to reach the end. A potential solution is :

JavascriptExecutor js = (JavascriptExecutor) driver; 
HashMap scrollObject = new HashMap(); 
scrollObject.put("direction", "up"); 
scrollObject.put("xpath", "//XCUIElementTypeStaticText[@name=\"NAME\"]");
for(int i=0; i<10;i++){
    js.executeScript("mobile: swipe", scrollObject);
}

This script will swipe 10 times. You could make it more flexible by knowing how many times exactly you need to swipe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM