Reputation: 3099
Chrome has a really awesome feature that allows you to open the dev tools from another browser or window. It works by starting chrome with this flag:
--remote-debugging-port=9222
Then from another window/browser you can go to http://localhost:9222 and open dev tools for any running tab in Chrome. For security reasons Chrome will not allow access from another machine by IP, lets say http://192.168.1.2:9222.
However there is an additional flag that indicates it opens this ability, here is what Chrome has to say for it:
--remote-debugging-address
Use the given address instead of the default loopback for accepting remote debugging connections. Should be used together with --remote-debugging-port. Note that the remote debugging protocol does not perform any authentication, so exposing it too widely can be a security risk.
Either it's not working or I have no idea how to format it. I have tried the following:
--remote-debugging-port=9222 --remote-debugging-address=http://192.168.1.2:9222
--remote-debugging-port=9222 --remote-debugging-address=http://192.168.1.2
--remote-debugging-port=9222 --remote-debugging-address=192.168.1.2:9222
--remote-debugging-port=9222 --remote-debugging-address=192.168.1.3 //maybe thinking its supposed to be the IP of the remote machine
The target machine a Mac
Upvotes: 21
Views: 40975
Reputation: 3073
Chrome has removed the "--remote-debugging-address" flag, it appears.
https://issues.chromium.org/issues/40242234
Upvotes: 0
Reputation: 2335
--remote-debugging-address
is semantically different from chromedriver's --whitelisted-ips
The remote debugging address must specify the address to bind to. So what you want in there is your machine's IP address not the address you will be connecting from. Try binding to all interfaces with --remote-debugging-address=0.0.0.0
Upvotes: 5
Reputation: 131
Try create a HTTP-proxy in your target machine.
httpProxy
.createServer({
target: wsurl,
ws: true,
localAddress: host
})
.listen(port);
works for me.
Upvotes: 3
Reputation: 1399
it turned out, that the option "--remote-debugging-address" can only be used for the headless mode ("--headless") and is intended to be used for tests when the browser runs in a docker container and not for remote debugging.
The parameter of "remote-debugging-address" must be the numeric ip-adress of a local network interface of the machine where you start Chrome with "--remote-debugging-address". When using any non-local ip-address you will get the following errors:
[0526/132024.480654:ERROR:socket_posix.cc(137)] bind() returned an error, errno=49: Can't assign requested address
[0526/132024.480766:ERROR:devtools_http_handler.cc(226)] Cannot start http server for devtools. Stop devtools.
On my Mac I can start the Chrome Canary version from today using this command line (the current stable version just crashes with "--headless"):
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --remote-debugging-port=9222 --remote-debugging-address=192.168.1.20 --headless
In another shell you can see, that this address is used to listen on the socket:
netstat -a -n | grep 9222
tcp4 0 0 192.168.1.20.9222 *.* LISTEN
Without "--headless" the output will look like this:
tcp4 0 0 127.0.0.1.9222 *.* LISTEN
Michael
Upvotes: 29