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.
Finally, found a solution for it.
static void launchSecurityXxxApp(AppiumDriver<AndroidElement> driver) throws MalformedURLException {
String appPackage="com.xxx.xxxx";
String appActivity="com.xxx.xxxx.Launchable";
Activity activity = new Activity(appPackage, appActivity);
activity.setStopApp(false);
((AndroidDriver<AndroidElement>) driver).startActivity(activity);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.