Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket hang up #98

Open
MT22067 opened this issue Apr 19, 2024 · 4 comments
Open

Socket hang up #98

MT22067 opened this issue Apr 19, 2024 · 4 comments

Comments

@MT22067
Copy link

MT22067 commented Apr 19, 2024

Environment

| Component | Version

| Node.js | v12.22.9
| Client (Chrome/Chromium/...) | Google Chrome 123.0.6312.58
| OS running Node.js | Ubuntu 22.04
| OS running the client | Ubuntu 22.04
| chrome-remote-interface | 0.31.3

Is the client running in a container? NO

Description

I was trying to run the following the set of commands (basically to capture HAR file from android) chrome
(1) 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 --force --port 9222 -o my.har http://www.example.com
Issue received: Socket hang up
How to solve this?

@cyrus-and
Copy link
Owner

Are you able at point 3 to run:

curl -i http://127.0.0.1:9222/json/list

If not, there's some TCP connection issue with your phone.

@MT22067
Copy link
Author

MT22067 commented Apr 19, 2024

Nope, I am not able to. Any help on how to proceed about it?

@MT22067
Copy link
Author

MT22067 commented Apr 19, 2024

I did packet capture and could see a few ports connected to 9222 constantly. (exchanging keep-alive messages) I guess forwarding should have worked fine. are you saying that I should capture packets on the mobile device interface?

@cyrus-and
Copy link
Owner

So the reason is this:

$ chrome-remote-interface inspect -l -w ws://127.0.0.1:9222/devtools/browser
>>> Target.createBrowserContext()
Uncaught ProtocolError: Failed to create browser context.
    at /Users/cyrus/Dropbox/dev/chrome-remote-interface/lib/chrome.js:94:35
    at Chrome._handleMessage (/Users/cyrus/Dropbox/dev/chrome-remote-interface/lib/chrome.js:272:17) {
  request: {
    method: 'Target.createBrowserContext',
    params: undefined,
    sessionId: undefined
  },
  response: { code: -32000, message: 'Failed to create browser context.' }
}

I have no idea why this fails on Chrome for Android, in any case this issue concerns chrome-har-capturer, not this repo.

@cyrus-and cyrus-and transferred this issue from cyrus-and/chrome-remote-interface May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants