How to go to next screen of an app using appium?

江枫思渺然 提交于 2019-12-12 06:56:27

问题


Can anyone tell me how to go to next screen, for example like in Times of India or Indian Express app or news in shorts app, there are 50 news stories and I want to go on all the pages so how to swipe till 50th page?

I tried driver.swipe(344, 955, 346,247, 3000); with that I am able to swipe to next pages, but I am not sure how go to all the 50 pages one by one.


回答1:


Have you tried a for loop?

int pageCount = 50;
for(int currentPage = 1; currentPage < pageCount; currentPage++){
    driver.swipe(344, 955, 346,247, 3000);
    Thread.sleep(1000);//If you want to wait 1 second between pages
    //Or do whatever you want on each page.
}


来源:https://stackoverflow.com/questions/39330373/how-to-go-to-next-screen-of-an-app-using-appium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!