gpt4 book ai didi

java - 无法在移动 Chrome 浏览器中导航

转载 作者:太空宇宙 更新时间:2023-11-04 12:31:35 26 4
gpt4 key购买 nike

我有以下代码,它将启动一个应用程序并切换到移动 Chrome 浏览器并导航到 www.google.com

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("BROWSER_NAME","Android");
capabilities.setCapability("device","Android");
capabilities.setCapability("deviceName","hammerhead");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("appPackage","com.android.calculator2");
capabilities.setCapability("appActivity","com.android.calculator2.Calculator"
);
mobileDriver = new AndroidDriver(new URL(
"http://127.0.0.1:4723/wd/hub"), capabilities);
mobileDriver.startActivity("com.android.browser","com.android.browser.BrowserActivity");
mobileDriver.get("www.google.com");

当调用 .get 方法时,执行会抛出以下错误:

Not yet implemented. Please help us: http://appium.io

最佳答案

如果您的需求仅限于打开 Chrome 浏览器到 X url,您应该查看 ACTION_VIEW 隐式 Intent。

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);

关于java - 无法在移动 Chrome 浏览器中导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37810650/

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