Skip to content

[🐛 Bug]: [bidi] Chrome is closing after opening Developer Tools #15679

Open
@Zlaman

Description

@Zlaman

Description

  1. Run below code with breakpoint on System.out.println
  2. Open Developer Tools in Chrome
    Browser gets closed automatically

It is reproducing with/without Selenium Grid, on Windows and Mac.
Using Chrome version 137.0.7151.41 and Selenium 4.32.0
If options.enableBiDi(); is commented, issue is not reproducing.
If

driver.switchTo().window(newWindowHandle).close();
driver.switchTo().window(currentWindowHandle);

is commented, issue is not reproducing with BiDi enabled.
Once driver.switchTo().window(newWindowHandle).close(); is executed, opening Developer Tools will cause browser to close.

Reproducible Code

ChromeOptions options = new ChromeOptions();
options.enableBiDi();
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.selenium.dev");
WebElement element = driver.findElement(By.cssSelector("[href='https://opencollective.com/selenium']"));
new Actions(driver).scrollToElement(element).perform();
element.click();
String currentWindowHandle = driver.getWindowHandle();
String newWindowHandle = driver.getWindowHandles().stream()
          .filter(handle -> !handle.equals(currentWindowHandle)).findFirst().get();
driver.switchTo().window(newWindowHandle).close();
driver.switchTo().window(currentWindowHandle);
System.out.println("Put breakpoint here and open Dev Tools in browser, browser will close");

Debugging Logs

https://gist.github.com/Zlaman/62c3c6ca9cecb9514e5e2ebc71a10bf1

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsD-chromeI-defectSomething is not working as intendedOS-windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions