Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swipe method not supporting in android appium

I tried with swipe method in android,but it not working.

Code:-

public void swipe() {
    JavascriptExecutor js = (JavascriptExecutor) driver;
    HashMap < String, Double > swipeObject = new HashMap < String, Double > ();
    swipeObject.put("startX", 0.95);
    swipeObject.put("startY", 0.5);
    swipeObject.put("endX", 0.05);
    swipeObject.put("endY", 0.5);
    swipeObject.put("duration", 1.0);
    js.executeScript("emulator: swipe", swipeObject);
}

Error:-

org.openqa.selenium.WebDriverException: Not yet implemented.

Any help great apprciation.

like image 214
Ramesh Avatar asked Oct 19 '22 13:10

Ramesh


1 Answers

Changing the context to NATIVE_APP worked for me:

String originalContext = driver.getContext();
driver.context("NATIVE_APP");
driver.swipe(startx, starty, endx, endy, duration);
driver.context(originalContext );
like image 179
Nitesh Avatar answered Nov 04 '22 01:11

Nitesh