How to invoke Recent apps activity and launch app from recent app list by using appium?
driver.pressKey(187); --> driver.findElements(āApp Nameā).click();
Thanks for your reply.
Still Iām facing the problemsā¦find below code for your reference.
AppiumDriver driver;
AndroidDriver drAndroid;
public void recentApp() {
// driver.pressKey(187); //getting error after that created " drAndroid"
drAndroid.pressKeyCode(187);
driver.findElements("Whatsapp").click(); // I'm not able to use driver.findElements
}
drAndroid.pressKeyCode(187);
drAndroid.findElement(āWhatsappā).click();
Try aboveā¦ BTW why do u require two driver instances?
First instance is not working. Thatās why created second instance as AndoridDrvier(will delete AppiumDriver).
Question 1 : ----- not able to use Home package
capabilities.setCapability(āappPackageā, ācom.android.systemuiā);
capabilities.setCapability(āappActivityā, ācom.android.systemui.recents.RecentsActivityā);
@BeforeClass Setup
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Permission to start activity denied.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4.57 seconds
Qaestion 2 -------- if i use launcer activity gettting ānullā exceptionā¦plz refer below code
capabilities.setCapability(āappPackageā, ācom.android.launcherā);
capabilities.setCapability(āappActivityā, ācom.android.launcher2.Launcherā);
Thread.sleep(5000);
drAndroid.findElement(By.id("com.android.systemui:id/task_view_bar")).click();
recent app list is displaying for a while n getting Exception is - ā null ā
Priyank - itās working fine and find below code for all referenceā¦
Thanks for your suggestion.
AndroidDriver driver;
capabilities.setCapability(āappPackageā, ācom.android.launcherā);
capabilities.setCapability(āappActivityā, ācom.android.launcher2.Launcherā);
driver = new AndroidDriver(new URL(āhttp://127.0.0.1:4723/wd/hubā), capabilities);
Thread.sleep(5000);
driver.pressKeyCode(187);
driver.findElement(By.name(āMessagingā)).click();
Hi Rahul,
I tried out the above code. But getting back:
org.openqa.selenium.InvalidSelectorException: Locator Strategy ānameā is not supported for this session
Any idea on this?
Byname is depreciated and also, how to get app name ?
driver.pressKey(new KeyEvent(AndroidKey.APP_SWITCH));
driver.pressKey(new KeyEvent(AndroidKey.DPAD_DOWN));
driver.pressKey(new KeyEvent(AndroidKey.DPAD_DOWN));
driver.pressKey(new KeyEvent(AndroidKey.ENTER));