Chrome-har-capturer和Android通过ADB

时间:2016-08-12 15:51:16

标签: android google-chrome adb har

我需要通过ADB将chrome-har-capturer与Android手机一起使用。

使用本地计算机上的Chrome,可以使用以下开关启动Chrome:

--remote-debugging-port=<port>

然后使用如下的chrome-hat-c​​apturer连接到指定的端口进行远程调试:

chrome-hat-capturer --port <port>  -o out.har

Android的问题是虽然我可以使用ADB在Android上启动Chrome,但它不接受远程调试开关:

db shell am start -n com.android.chrome/com.google.android.apps.chrome.Main --remote-debugging-port=9222

Error: Unknown option: --remote-debugging-port=9222

知道怎么做吗?

1 个答案:

答案 0 :(得分:0)

对于其他试图这样做的人,我发现了如何做到这一点:

在你当地的机器上:

1)运行chrome:

adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main

2)转发调试端口:

adb forward tcp:9222 localabstract:chrome_devtools_remote

3)运行chrome-har-capturer:

chrome-har-capturer --force --port 9222 -o my.har http://www.example.com

请注意,您必须使用 - 强力选项。

相关问题