简体   繁体   English

如何使用selendroid网络驱动程序滑动手势?

[英]How to do swipe gestures using selendroid web driver?

  1. I have tried with below codings for swiping a mobile pages. 我尝试使用下面的代码来刷卡移动页面。

  2. While running the test case, the swipe action doesn't occurs and i am also not getting any error message. 在运行测试用例时,不会发生滑动操作,并且我也没有收到任何错误消息。

3.How can I swipe on both side from left to right and vice-versa. 3.如何从左向右在两侧滑动,反之亦然。

1. //Swipe Right to Left side of the Media Viewer First Page
                WebElement firstPages = driver.findElement(By.id("media-list"));
                TouchActions flick = new TouchActions(driver).flick(firstPages,-100,0,0);
                flick.perform();

2. //perform swipe gesture
               TouchActions swipe = new TouchActions(driver).flick(0, -20);
               swipe.perform();

Here is my code to flick pages and it is working fine for me 这是我的代码滑动页面,对我来说很好

for (int i = 0; i <= 3; i++) {
            Thread.sleep(5000);
            WebElement pages = driver.findElement(By.id("action_bar_overlay_layout"));
            TouchActions flick = new TouchActions(driver).flick(pages, 500, 0, 0);
            flick.perform();
        }

You can flick in both sides by just changing the sign of the x-parameter whose value is 500 here. 您只需在此处更改值为500的x参数的符号即可左右滑动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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