gpt4 book ai didi

java - 自动化测试时如何使用android默认浏览器

转载 作者:太空狗 更新时间:2023-10-29 13:59:35 26 4
gpt4 key购买 nike

我想在 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");

关于java - 自动化测试时如何使用android默认浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36905782/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com