问题
I'm facing an issue in scrolling down till the end of the screen. As this page is dashboard screen and which is of "UIACollection"
I had tried scroolTo, ScroolTOExact methods but it was not working and finally tried with IOSAutomation by using xcode xpath
Now I'm able to scroll but not totally (means not till end of the screen). I have a string at the bottom of the screen where I need to do assertion on it but I'm unable to do due to this issue
IOSAutomation xpath code
driver.findElement(MobileBy.IosUIAutomation("target.frontMostApp().mainWindow().scrollViews()[0].collectionViews()[0].scrollToVisible();"));
Result of that code Please find the image
Now I want to do assertion on the "Last 14 days" string which is present on the last 2 tiles in which the page is not getting scrolled totally upto the bottom of the screen
I'm able to get the xpath of that string "Last 14 days". But the only issue here is the screen is not totally scrolling down to the bottom of the page.
For the remaining tiles which contains that string, I'm able to do assert for that.
As I need to test in many different devices where x, y coordinates doesn't work in this case.
Please help me in resolving this issue.
Thanks in advance Dashboard after scroll
回答1:
Try driver.swipe() instead of scroll methods
回答2:
I found the solution
for(int i =0; i<5; i++){
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap scrollObject = new HashMap();
scrollObject.put("direction", "down");
js.executeScript("mobile: scroll", scrollObject);
}
来源:https://stackoverflow.com/questions/39466506/unable-to-scroll-down-till-the-end-of-the-screen-in-native-ios-app-using-appium