Monday 23 November 2015

swipe android by size

 Dimension size = driver.manage().window().getSize();
               int endx = (int) (size.width * 0.5);
               int endy = (int) (size.height * 0.8);
               int startx = (int) (size.width * 0.4);
               int starty = (int) (size.height * 0.40);
               driver.swipe(startx, starty, endx, endy, 1500);

OR

 //Swipe up
 int height=driver.manage().window().getSize().height;
          System.out.println(height);

          int weight=driver.manage().window().getSize().width;
          System.out.println(weight);

        driver.swipe(weight/2, height/2-180, weight/2, height-90, 1500);
          driver.swipe(weight/2, height/2-180, weight/2, height-90, 1500);

              

No comments:

Post a Comment