我想在android默认浏览器(不是chrome)中自动化一些测试用例。这是我的渴望能力:

DesiredCapabilities capabilities = new DesiredCapabilities().android();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "browser");
capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "My Device");
capabilities.setCapability(MobileCapabilityType.VERSION, "5.1.1");
capabilities.setCapability("appPackage", "com.android.browser");
capabilities.setCapability("appActivity", "com.android.browser.BrowserActivity");

当我通过appium运行任何测试用例时,输出为:
A new session could not be created. (Original error: An unknown server-side error occurred while processing the command. (Original error: unknown error: com.android.browser is not installed on device a5cde43e

如果有人对如何解决此问题有任何想法,请告诉我。提前致谢。

最佳答案

尝试以下一项 Activity ,

//Android Default Browser
//          capabilities.setCapability("appPackage","com.sec.android.app.sbrowser");
            capabilities.setCapability("appPackage","com.android.browser");
            capabilities.setCapability("appActivity","com.android.browser/.BrowserMainActivity");

10-07 22:37