简体   繁体   English

如何使用 Appium 从一个原生应用程序切换到另一个原生应用程序?

[英]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:尝试使用下面提到的startActivty()方法:

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.使用带有 v1.4.1 的 appium 桌面,任何来自自动化极客的解决方案都将不胜感激。

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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法从本地上下文使用appium切换到webview。 - cannot switch to webview using appium from native context. 如何使用Java中的appium为Android本机应用程序执行滑动 - How to perform swipe using appium in Java for android native app 使用 Appium 在 Android 本机应用程序中滚动的问题 - Issue with Scrolling in Android Native app using Appium 在本机应用程序中使用Appium处理弹出窗口 - Handling popups with Appium in a native app 当某些字段为空白时,使用appium识别本机应用程序上的错误 - Identifying error on the native app using appium when some field is blank 如何从我的 android React Native 应用程序打开另一个应用程序? - How to open another app from my android React Native app? 按下按钮时将本机切换屏幕的一个组件反应为另一个组件 - React native switch screen one component to another on button press 如何使用Android中的本机代码将文件从一个目录复制到另一个目录? - How to copy file from one directory to another using native code in Android? C#-中的Appium本机应用程序自动化 - Appium Native App Automation in C#- 如何使用 React Native 将一个页面导航到另一个页面? - How to navigate one page to another page using React Native?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM