0
                      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 真实设备中滑动我的滑动已弃用提前谢谢

4

1 回答 1

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、click...)如果您的 screenWidth 为 800 并且您 .press(400, anyY),则在 moveTo 处您只能添加 .moveTo(400...

并通过驱动程序滑动(已弃用...)

//startX, startY, endX, endY and 1tap
driver.swipe(393, 446, 1902, 407, 1)
于 2017-11-30T14:45:31.730 回答