'How to switch from one native to another native app using Appium?
I have to switch to another native application from runtime native application. Tried with below the mentioned startActivty() methods:
driver.startActivity(settingsAppPackageName, settingsAppActivityName);
&
driver.startActivity(new Activity("package.activityname"));
Using appium desktop with v1.4.1 any solution from automation geeks would be appreciated.
Solution 1:[1]
protected static final String appPackage1="app package name";
protected static final String appActivity1="your activity name";
protected static final String appPackage2="app package name";
protected static final String appActivity2="your activity name";
public static AndroidDriver<MobileElement> setupDriver(String appPackage, String appActivity) throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "Any na,e");
caps.setCapability("udid", "your device uuid");
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "your device android version");
caps.setCapability("appPackage", appPackage);
caps.setCapability("appActivity", appActivity);
caps.setCapability("noReset", "true");
return new AndroidDriver<MobileElement>(new URL(
"http://127.0.0.1:4723/wd/hub"), caps);
}
public static void main(String[] args) throws MalformedURLException {
AppiumDriver<MobileElement> driver=setupDriver(appPackage1, appActivity1);
driver=setupDriver(appPackage2, appActivity2);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
