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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Browser-wide DevTools client failed to connect: disconnected: unable to connect to renderer #11809

Closed
riki95 opened this issue Mar 23, 2023 · 27 comments

Comments

@riki95
Copy link

riki95 commented Mar 23, 2023

What happened?

I have a script that runs Selenium to open a ChromeDriver in headless mode and perform some operations.

I am using

chromium --version
Chromium 111.0.5563.64 snap

And I have a row in the code that sets Chromedriver version to the same one: WebDriverManager.chromedriver().driverVersion("111.0.5563.64").setup();

I also have this settings as arguments:
options.addArguments("--headless", "--lang=it", /* "--no-sandbox", */ /*"--disable-dev-shm-usage", */"start-maximized", "--disable-gpu", "--window-size=1920,1200", "--ignore-certificate-errors", "--disable-extensions", "disable-infobars", "--remote-allow-origins=*");

Also, I am using the latest 4.8.1 Selenium Version through Maven.

When I run my script, I get this error: [1679566402.801][WARNING]: Browser-wide DevTools client failed to connect: disconnected: unable to connect to renderer

How can we reproduce the issue?

- Install Chromium 111.0.5563.64 snap
- Use WebDriverManager.chromedriver().driverVersion("111.0.5563.64").setup();

Relevant log output

[pool-1-thread-2] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.chrome.driver as /home/forge/.cache/selenium/chromedriver/linux64/111.0.5563.64/chromedriver
[2023-03-23 10:13:22.698] [pool-1-thread-2]  Setting up --remote-debugging-port=59112

Starting ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}) on port 31037
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1679566402.801][WARNING]: Browser-wide DevTools client failed to connect: disconnected: unable to connect to renderer

Operating System

Ubuntu 20.04.5 LTS (Focal Fossa)

Selenium version

4.8.1

What are the browser(s) and version(s) where you see this issue?

Chrome / Chromium 111.0.5563.64

What are the browser driver(s) and version(s) where you see this issue?

111.0.5563.64

Are you using Selenium Grid?

No response

@github-actions
Copy link

@riki95, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

This is likely a duplicate of #11750

Take a look at #11750 (comment)
Next version of Selenium should be released soon, but can also see if the other solutions fix this.

@riki95
Copy link
Author

riki95 commented Mar 23, 2023

This is likely a duplicate of #11750

Take a look at #11750 (comment) Next version of Selenium should be released soon, but can also see if the other solutions fix this.

I already tried the fix suggested in the comment, but it does not work.

@sathishkumarAR
Copy link

This is likely a duplicate of #11750

Take a look at #11750 (comment) Next version of Selenium should be released soon, but can also see if the other solutions fix this.

We also tried the fix suggested in the comment, but it does not work.

Approximately, when can we expect the next version of Selenium will be released with this fix?

@titusfortner
Copy link
Member

Doesn't snap have its own driver you need to use? I don't think WebDriverManager manages that right now.

@riki95
Copy link
Author

riki95 commented Mar 28, 2023

Good morning, is there an ETA for this?
We still have no fix and it seems this issue is blocking a lot of people

@titusfortner
Copy link
Member

Please try with 4.8.3 which was released earlier this week. If it is not working, please provide a full stack trace / logs. Thanks.

@riki95
Copy link
Author

riki95 commented Mar 31, 2023

Still not working. I am using these dependencies:

pom.xml
		<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.8.3</version>
            <scope>compile</scope>
		</dependency>

		<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
            <version>4.8.3</version>
            <scope>compile</scope>
		</dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-http-jdk-client</artifactId>
            <version>4.8.3</version>
        </dependency>

This is the code I use to run my script and open Chrome:

Code
 try {
            // https://chromedriver.chromium.org/downloads
            WebDriverManager.chromedriver().driverVersion("112.0.5615.28").setup();
            ChromeOptions options = new ChromeOptions();

            options.addArguments("--headless=new", "--lang=it", /* "--no-sandbox", */ /*"--disable-dev-shm-usage",  */"start-maximized", "--disable-gpu", "--window-size=1920,1200", "--ignore-certificate-errors", "--disable-extensions", "disable-infobars", "--remote-allow-origins=*");

            if (PRJ_ENV.equals("SERVER")) {
                String remotePort = String.format("--remote-debugging-port=%s", port);
                Utils.Print(username, String.format("Setting up %s", remotePort));
                options.addArguments(remotePort);
            }

            driver = new ChromeDriver(options);
            res.driver = driver;
            Utils.Print(username, "Driver instantiated");
        } catch (Exception e) {
            return responseWithMessage(res, "error opening chrome");
        }

I tried with different Chrome Driver versions, both 111.0.5563.64 and 112.0.5615.28 even if my Chromium is at 111.
Noth working in both cases.

The only difference is that with Chrome Driver 112, I don't get this error:
1679566402.801][WARNING]: Browser-wide DevTools client failed to connect: disconnected: unable to connect to renderer

The program just runs and do nothing.
If I try to run it locally with a UI and remove --headless, I see that Chrome opens and closes suddenly.
So my app is still broken and not fixed.

@riki95
Copy link
Author

riki95 commented Apr 6, 2023

Updates on this?

@diemol
Copy link
Member

diemol commented Apr 6, 2023

So is it Chrome or Chromium? What are you using?

@diemol
Copy link
Member

diemol commented Apr 6, 2023

Does it only happen with headless?

@riki95
Copy link
Author

riki95 commented Apr 6, 2023

So is it Chrome or Chromium? What are you using?

Chromium on linux

@riki95
Copy link
Author

riki95 commented Apr 6, 2023

Does it only happen with headless?

No even without and using chrome on Mac, same issue

@diemol
Copy link
Member

diemol commented Apr 6, 2023

OK, so if I use the code from this link on macOS, I should be able to reproduce the issue. Did I get that right?

@riki95
Copy link
Author

riki95 commented Apr 6, 2023

OK, so if I use the code from this link on macOS, I should be able to reproduce the issue. Did I get that right?

Well that's the connection part, you can try

@titusfortner
Copy link
Member

If it is snap, I think you need to pass in the location of the driver distributed with snap

@riki95
Copy link
Author

riki95 commented Apr 6, 2023

If it is snap, I think you need to pass in the location of the driver distributed with snap

What do you mean?

@titusfortner
Copy link
Member

Snap requires different driver settings so there is a different driver distributed by snap, which webdriver manager doesn't support. You need to specify that driver in the system properties instead of using the manager.

@riki95
Copy link
Author

riki95 commented Apr 7, 2023

I fixed installing Chrome instead of Chromium. Thanks

@riki95 riki95 closed this as completed Apr 7, 2023
@Abduhamid93
Copy link

riki95 can you please explain what do you mean by installing Chrome instead Chromium mean? I鈥檓 getting the same issue. I thought it is because an organization ban on third tools.

If you can pass one script here, it would be great

@riki95
Copy link
Author

riki95 commented Apr 8, 2023

riki95 can you please explain what do you mean by installing Chrome instead Chromium mean? I鈥檓 getting the same issue. I thought it is because an organization ban on third tools.

If you can pass one script here, it would be great

Hi, it's simple
In my linux it was installed chromium instead of chrome. So if you do chromium -- version you get an answer, while if you do google-chrome --version you do not.
I manually uninstalled chromium and then I manually installed chrome via terminal.
This worked because chromium uses different versions. I aligned chrome and chromedriver versions and everything is working perfectly.

Hope it helps

@melisagit
Copy link

melisagit commented Apr 17, 2023

Hi, it's simple In my linux it was installed chromium instead of chrome. So if you do chromium -- version you get an answer, while if you do google-chrome --version you do not. I manually uninstalled chromium and then I manually installed chrome via terminal. This worked because chromium uses different versions. I aligned chrome and chromedriver versions and everything is working perfectly.

Hi @riki95, I installed google-chrome but I'm still seeing basically the same error.

Selenium::WebDriver::Error::UnknownError:
   unknown error: Chrome failed to start: crashed.
      (chrome not reachable)
      (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Has anybody else resolved this issue by replacing chromium with google-chrome?

@Alex737Git
Copy link

"I had the same problem and tried changing the chromedriver to match my Chrome browser version, but it didn't help. I double-checked my Chrome version by going to Settings -> About Chrome and saw that it was the same as my chromedriver's version. As a result, Chrome started updating automatically. After the update was complete, everything started working correctly and the problem disappeared."

@titusfortner
Copy link
Member

  1. If you are using a non-default/production version of Chrome installed natively on the system, you need to explicitly pass in the location of the browser you want with the setBrowser() method on the Options class.
  2. If you are using snap, you need to make sure you are using the browser driver that is provided by that package manager as the default one you download will not work, you can specify the location of this in the Service class
  3. Version of Chrome must match the version of Chromedriver

@melisagit
Copy link

melisagit commented May 2, 2023

We encounter inconsistent DevTools errors (sometimes, the test pass without DevTools issues). We believe that this inconsistency may be due to some sort of network or timing-related issues. For example, if we run Capybara spec features tests n times, half of the time we have DevTools errors. We don't think there are issues with our setup since sometimes the test passes without DevTools issues. Has anyone also encountered inconsistency issues?

Driver Setup:
Capybara.register_driver :headless_chrome do |app|
    opts = Selenium::WebDriver::Chrome::Options.new

    chrome_args = %w[--no-sandbox --verbose --log-level=1 --start-maximized --disable-infobars --disable-extensions --disable-browser-side-navigation --headless=new --disable-dev-shm-usage --disable-gpu --disable-extensions --disable-popup-blocking --window-size=1920,2000 --remote-debugging-port=9222 --page_load_strategy='none']
    
    chrome_args.each { |arg| opts.add_argument(arg) }
    Capybara::Selenium::Driver.new(app, browser: :chrome, options: opts)
end

Log output:
Got 0 failures and 2 other errors:

2.1) Failure/Error: expect(page).to have_text('Any Text')

   Selenium::WebDriver::Error::WebDriverError:
      target frame detached
         (failed to check if window was closed: disconnected: Unable to receive message from renderer)
         (Session info: headless chrome=112.0.5615.49)

2.2) Failure/Error: Unable to infer file and line number from backtrace

   Selenium::WebDriver::Error::WebDriverError:
      disconnected: not connected to DevTools
         (failed to check if window was closed: disconnected: not connected to DevTools)
         (Session info: headless chrome=112.0.5615.49)

Operating System

  • Ubuntu 20.04 LTS

Selenium version

  • Ruby 3.2.2 with gems:
  • selenium-webdriver 4.8.6
  • capybara 3.39.0
  • rspec 3.12.0

The browser and version

  • Chromium Browser 112.0.5615.49

The browser driver and version

  • ChromeDriver 112.0.5615.49

@SmartDev-0205
Copy link

IT is because driver is not closed and you try run again.
Try to reboot or change port id.
options.addArguments("--remote-debugging-port=9230")
You can change this port.
Thanks

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants