I could not pick an incoming call inside an android device using appium. tried swipe and tap options but no luck.
How to acheive this? iT looks like a hard swipe. Tried swipe when there is no incoming call and it worked fine but but passing the property of incoming call and swipe does not work.
Tried swipe and tap methods but no luck.
below is the code i tried.
DesiredCapabilities cap_1 = new DesiredCapabilities();
cap_1.setCapability("appium:deviceName","Galaxy A15 5G");
cap_1.setCapability("platformName","Android");
cap_1.setCapability("appium:platformVersion","14");
cap_1.setCapability("browserName","Android");
cap_1.setCapability("appium:udid","MYUDID");
cap_1.setCapability("appium:automationName",
"UiAutomator2");
URL url = new URL("http://127.0.0.1:4723/wd/hub");
WebElement element = driver_mb1.findElement(By.xpath("//android.view.ViewGroup[@resource-id="com.samsung.android.incallui:id/accept_button_in_3_way"]"));
driver_mb1 = new AppiumDriver(url,cap_1);
JavascriptExecutor js = (JavascriptExecutor) driver_mb1;
Map<String, Object> params = new HashMap<>();
params.put("elementId",element);
params.put("direction","left");
params.put("percent",0.75);
js.executeScript("mobile:swipeGesture",params);
((JavascriptExecutor) driver_mb1).executeScript("mobile: pressKey", Map.ofEntries(Map.entry("keycode", 5)));
This worked as solution for me with latest version of java and Appium