1

I try to fix some old ruby app. But I have an issue with selenium tests. I debug gems and found out that test runners start the Google Chrome with that options: path\to\chrome --headless --no-sandbox --remote-debugging-port=9222 then waits a moment and sends a get request to localhost:9222/json. When the test worked, the response to the above request was not empty, but now I got only [ ].

The tests are triggered in SemaphoreCI on ubuntu with the latest Google Chrome and Google Chrome driver. Any idea what may be wrong?

user3493916
  • 43
  • 1
  • 8

2 Answers2

1

Starting with Chrome 111 it is required to add

--remote-allow-origins=*

as a parameter.

irotas
  • 11
  • 1
  • 2
    It did not help. I found that I need add `about:blank` argument in command to start chrome. I guess this is a breaking change, but I did not found nothing else – user3493916 Mar 28 '23 at 14:33
  • 1
    Holy cow, you saved the day. To summarize for anybody who is having "No inspectable targets" errors with recent Chrome / Chromium running in headless mode, but not experiencing it in "normal" interactive mode - Chrome(ium) did a breaking change recently, and when started headless, it seems it has somehow "zero" tabs open. No tab, nothing to remotely control and the instatiation of e.g. a "chrome-remote-interface" object fails constantly with this error. Solution: as you wrote above, the command line needs an url, and `about:blank` is a short and failsafe way to provide one. Thanks !!! – Peter Apr 02 '23 at 18:20
  • Note, without `--remote-allow-origins=*`, chrome will return 403 even Origin header is localhost. – PaleNeutron Aug 18 '23 at 03:31
0

You should send a get request to http://localhost:9222/json/version

AlphaTr
  • 1
  • 2