本文介绍了在appium中滑动或滚动到底部-android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用appium在Android应用程序中将滚动条滑动到底部? 我尝试使用
How can I swipe scroll to bottom in an android app using appium? I tried using
driver.swipe(300,800,300,500,2); driver.scrollTo("string")但是上面没有帮助.谁能建议我一些通用的解决方案?
But above did not helped. Can anyone suggest me some generic solution ?
推荐答案通用解决方案将使用尺寸进行滚动.使用以下代码
A generic solution will be scrolling using dimensions. use the below code
public void scroll() throws IOException { try { Dimension dimensions = driver.manage().window().getSize(); System.out.println("Size of screen= " +dimensions); int Startpoint = (int) (dimensions.getHeight() * 0.5); System.out.println("Size of scrollStart= " +Startpoint ); int scrollEnd = (int) (dimensions.getHeight() * 0.2); System.out.println("Size of cscrollEnd= " + scrollEnd); driver.swipe(0, Startpoint,0,scrollEnd,1000); } catch (IOException e) { } }将此添加到我们的代码中,只需使用scroll();即可.在您的测试用例中.修改代码中给出的十进制值以满足您的要求
add this to ur code and simply use scroll(); in ur test case. Modify the decimal values given in the code to nmeet your requirements
更多推荐
在appium中滑动或滚动到底部
发布评论