如何在appium真实设备中滑动我的滑动已弃用

时间:2017-11-30 12:20:36

标签: java android appium-android

                      How to swipe in appium real device my swipe is 
               Deprecated 

            in the latest android studio 2.3.3
            i am using java client 5.00 BETA 6 in eclipse 
            appium server desktop 1.7

          i tried the following method none works 
         following code does not not swipe the page down 

          i am trying to swipe in device setting  to click down page which is 
       not visible in view

        1.  new TouchAction(driver)
         .longPress(393, 446)
          .moveTo(1902, 407)
          .release()
           .perform();

       2. driver.swipe(startx, starty, endx, endy, duration);  its depreceted

       3. 
       MobileElement element = (MobileElement) 



       driver.findElement(By.xpath("//android.widget.TextView[contains(@resource-
          id,'title') and @text='Display']"));
       JavascriptExecutor js = (JavascriptExecutor)driver; 
           HashMap<String, String> scrollObject = new HashMap<String, String>(); 
        scrollObject.put("direction", "down"); 
              scrollObject.put("element", ((RemoteWebElement) element).getId());
             scrollObject.put("text", "Memory"); 
           js.executeScript("mobile: scrollTo", scrollObject);

             please help me to overcome from this i in deed stuck with this last 
             2 weeks please help me to overcome from this 


    Also please help me to swipe from left to 
    bottom as i need to know about 
    swipe in details i in deed stuck in
 appium swipe please help me come out out of this i tried lot of method

大多数情况下它不会起作用 请帮我 还请帮我刷左边         我需要了解的底部         详细刷卡我的行为陷入困境     如何在appium真实设备中滑动我的滑动                弃用          提前致谢

1 个答案:

答案 0 :(得分:0)

您是否尝试过等待TouchAction?

你有:

new TouchAction(driver)
                .longPress(393, 446)
                .moveTo(1902, 407)
                .release()
                .perform();

试试这个(只需按下更改longPress):

//Coordinates are relative, So at .moveTo(x,y) you have to add how many X and Y 
  do you want to moveTo from the start where you pressed...


new TouchAction(driver)
                .press(393, 446)
                .wait(500)
                .moveTo(400, 0) //This will move 400px from start point (393) 
                .release()
                .perform();

注意:你的屏幕大小是moveTo的限制(也适用于.press,点击...)如果你的screenWidth是800而你.press(400,anyY),则移动到你只能添加.moveTo(400 ...

使用驱动程序滑动(已弃用 ...)

//startX, startY, endX, endY and 1tap
driver.swipe(393, 446, 1902, 407, 1)