Skip to content

[🐛 Bug]: Screenshot fails with UnreachableBrowserException in Selenium 4.39.0 (works in 4.38.0) #16864

@haci56

Description

@haci56

Description

Calling TakesScreenshot#getScreenshotAs(...) throws
org.openqa.selenium.remote.UnreachableBrowserException in Selenium 4.39.0, while the exact same code works in 4.38.0.

The failure occurs regardless of whether:

OutputType.FILE

OutputType.BYTES

are used.

Environment

OS: Windows 11 (amd64)

Java: 11.0.19

Browser: Chrome 143.0.7499.170

ChromeDriver: 143.0.7499.169

Build tool: Gradle

✅ Working configuration
implementation "org.seleniumhq.selenium:selenium-java:4.38.0"
implementation "org.seleniumhq.selenium:selenium-devtools-v142:4.38.0"

❌ Failing configuration
implementation "org.seleniumhq.selenium:selenium-java:4.39.0"
implementation "org.seleniumhq.selenium:selenium-devtools-v142:4.38.0"

(Also fails with selenium-devtools-v143:4.39.0)

Observed behavior
org.openqa.selenium.remote.UnreachableBrowserException:
Error communicating with the remote browser. It may have died.

Command: [sessionId, screenshot []]
at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:350)

Browser process is still running, but screenshot fails immediately.

Expected behavior

Screenshot should be captured successfully, as it is in Selenium 4.38.0 with the same Chrome / ChromeDriver versions.

Reproducible Code

WebDriver driver = new ChromeDriver();

driver.get("https://www.google.com");

byte[] screenshot = ((TakesScreenshot) driver)
        .getScreenshotAs(OutputType.BYTES); // fails in 4.39.0

driver.quit();

ℹ️ Last known working version: 4.38.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions