2017-01-02 46 views

回答

0

您可以使用滑動方法從下往上滑動。
ds.swipe(startx,starty,endx,endy,500);

可以使用

0

(「元素的名稱」)scrollto由於它是混合應用程序,然後我們首先要改變Native_APP後來我們申請下面的代碼

Dimension size = driver.manage().window().getSize(); 
      System.out.println(size); 

      //Find swipe start and end point from screen's with and height. 
      //Find starty point which is at bottom side of screen. 
      int starty = (int) (size.height * 0.70); 
      //Find endy point which is at top side of screen. 
      int endy = (int) (size.height * 0.20); 
      //Find horizontal point where you wants to swipe. It is in middle of screen width. 
      int startx = size.width/2; 
      System.out.println("starty = " + starty + " ,endy = " + endy + " , startx = " + startx); 
0

這是我嘗試向下滾動側面菜單,找到一個註銷

//向下滑動側菜單,然後點擊註銷

@Test 
     public void T4b_logout() throws InterruptedException{ 
       size = driver.manage().window().getSize(); //Get the size of screen. 
       System.out.println(size);     
       int starty = (int) (size.height * 0.80);//Find starty point which is at bottom side of screen. 
       int endy = (int) (size.height * 0.20); //Find endy point which is at top side of screen.   
       int startx = size.width/2; //Find horizontal point where you wants to swipe. It is in middle of screen width.  
       System.out.println("starty = " + starty + " ,endy = " + endy + " , startx = " + startx); // int startx = size.width; 
       driver.swipe(startx, starty, startx, endy, 3000);//Swipe from Bottom to Top. 
       Thread.sleep(2000); 
       driver.findElement(By.name("Logout")).click(); 
       driver.findElement(By.xpath("//android.widget.Button[@text='Ok']")).click(); 

     } 
相關問題