Android ADB在默认浏览器以外的其他浏览器中打开URL

2024-09-20 23:00:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我如何启动web浏览器并使用adb搜索除默认值以外的网站,例如每次运行代码时,浏览器都会在默认的chrome应用程序中打开,但如果我希望它在Firefox或其他web浏览器上搜索网站,该怎么办


import time
from ppadb.client import Client as AdbClient
client = AdbClient(host="127.0.0.1", port=5037)
devices = client.devices()

if len(devices) == 0:
    print ('no device attached')
    quit()

device = devices [0]



device.shell('am start -a android.intent.action.VIEW -d https://smartbear.com/')


Tags: 代码fromimportclientweb应用程序time网站
1条回答
网友
1楼 · 发布于 2024-09-20 23:00:31

我认为您可以根据要使用的浏览器使用不同的am start命令,例如(对于Chrome):

device.shell('am start -n com.android.chrome/com.google.android.apps.chrome.Main -d https://smartbear.com/')

或(Firefox):

device.shell('am start -n org.mozilla.firefox/org.mozilla.gecko.BrowserApp -d https://smartbear.com/')

或(网络视图):

device.shell('am start -n org.chromium.webview_shell/org.chromium.webview_shell.WebViewBrowserActivity -d https://smartbear.com/')

等等

相关问题 更多 >

    热门问题