Skip to content

[🐛 Bug]: UnreachableBrowserException: Error communicating with the remote browser. It may have died. #2840

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

Open
prajaktak15 opened this issue May 21, 2025 · 4 comments

Comments

@prajaktak15
Copy link

prajaktak15 commented May 21, 2025

What happened?

We are facing issue while executing serenity tests in selenium grid. Serenity version is v4.2.16 .
Tests are failing with below error intermittently.

UnreachableBrowserException: Error communicating with the remote browser. It may have died.

Experiencing issue with selenium version v4.28 onwards for both platforms Linux and Windows.

Command used to start Selenium Grid with Docker (or Kubernetes)

version: "3.0"
services:

 selenium-sec-chrome_Container1:
    environment:
      - SE_EVENT_BUS_HOST=<Hub_Server>
      - SE_EVENT_BUS_PUBLISH_PORT=<Pubilsh_Port>
      - SE_EVENT_BUS_SUBSCRIBE_PORT=<Subscribe_Port>
      - SE_NODE_HOST=<Node_Host>
      - SE_NODE_PORT=<Node_Port>
      - SE_NODE_MAX_SESSIONS=8
      - SE_NODE_OVERRIDE_MAX_SESSIONS=true
      - REMOTE_HOST=https://${HOSTNAME}:<Host>
      - SE_OPTS=--https-certificate /home/seluser/g4httpsgsg.pem --https-private-key /home/seluser/g4httpsgsg.key 
      - SE_NODE_SESSION_TIMEOUT=900
      - SE_DRAIN_AFTER_SESSION_COUNT=100
      - SE_NODE_GRID_URL=<Pubilsh_Port>
#   image: /node-chrome:4.28.1-20250202
#   image: /node-chrome:4.32.0-20250505
    image: /node-chrome:4.30.0-20250323
    privileged: true
#    logging:
#     driver: "none"
    shm_size: 8gb
    ports:
      - <Port>:<Port>
    restart: always
    volumes:
      - /dev/shm:/dev/shm
      - /opt/grid/cert:/home/seluser

Relevant log output

1. Node error log : Selnium v4.30

Driver info: driver.version: unknown
org.openqa.selenium.WebDriverException: Build info: version: '4.30.0', revision: '509c7f1'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-553.47.1.el8_10.x86_64', java.version: '21.0.6'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:419)
        at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:54)
        at org.openqa.selenium.grid.web.ReverseProxyHandler.execute(ReverseProxyHandler.java:91)
        at org.openqa.selenium.grid.node.DefaultActiveSession.execute(DefaultActiveSession.java:62)
        at org.openqa.selenium.grid.node.local.SessionSlot.execute(SessionSlot.java:130)
        at org.openqa.selenium.grid.node.local.LocalNode.executeWebDriverCommand(LocalNode.java:718)
        at org.openqa.selenium.grid.node.ForwardWebDriverCommand.execute(ForwardWebDriverCommand.java:48)
        at org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:397)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
        at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:87)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:360)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
        at org.openqa.selenium.grid.node.Node.execute(Node.java:286)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:360)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:69)
        at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:63)
        at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:49)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.InterruptedException
        at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:386)
        at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
        at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:413)
        ... 26 more

2. Test Error Log :

org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '4.28.1', revision: '73f5ad48a2'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.7.5', java.version: '17.0.11'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [5206e5c379c7e2969c8257bd24bf086d, findElements [using, value]]

Operating System

Linux Redhat

Docker Selenium version (image tag)

4.30.0-20250323

Selenium Grid chart version (chart version)

No response

Copy link

@prajaktak15, 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!

@VietND96
Copy link
Member

Can you unmount this volume? Or a specific cert in another dir, not $HOME
- /opt/grid/cert:/home/seluser
Since under $HOME (/home/seluser), there are a few directory used by browser to init profile, cache something under .cache.
If still not working, can you share the code snippet to create RemoteWebDriver with all browser args might set there

@prajaktak15
Copy link
Author

Hello,

We are trying the given solution. Will share you results.

@prajaktak15
Copy link
Author

Hello,

We tried the given solution, getting same error.
Step failed
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.

code snippet to create RemoteWebDriver with all browser :

private void setBrowserCapabilities(MutableCapabilities capabilities) {
OS = OS != null ? OS : "ANY";
switch (gridAvailableBrowser) {
case "firefox" -> {
FirefoxOptions optionsFF = new FirefoxOptions();
optionsFF.addArguments("-headless");
optionsFF.addArguments("-private");
optionsFF.addPreference("dom.confirm_repost.testing.always_accept", true);
capabilities.setCapability(FirefoxOptions.FIREFOX_OPTIONS, optionsFF);
}
case "chrome" -> {
ChromeOptions optionsC = new ChromeOptions();
optionsC.setBrowserVersion("134.0");
optionsC.addArguments("--headless=new");
optionsC.addArguments("--incognito");
optionsC.addArguments("--window-size=1920,1080");
optionsC.addArguments("--remote-allow-origins=");
capabilities.setCapability(ChromeOptions.CAPABILITY, optionsC);
}
case "MicrosoftEdge" -> {
EdgeOptions optionsE = new EdgeOptions();
optionsE.addArguments("--headless=new");
optionsE.addArguments("--inprivate");
optionsE.addArguments("--window-size=1920,1080");
optionsE.addArguments("--remote-allow-origins=
");
capabilities.setCapability(EdgeOptions.CAPABILITY, optionsE);
}
}
capabilities.setCapability(CapabilityType.PLATFORM_NAME, Platform.valueOf(OS));
capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
capabilities.setCapability(CapabilityType.BROWSER_NAME, gridAvailableBrowser);
log.info("USING GRID MANAGER TO INSTANTIATE {} BROWSER on {}", gridAvailableBrowser.toUpperCase(), capabilities.getPlatformName().toString().toUpperCase());
}

Please let us know if you need more details.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants