Skip to content

[🐛 Bug]: driver.WindowHandles does not detect new tab opened by link or script in Selenium 4.26.0 (C#/.NET) #15703

Closed
@shyampatadia

Description

@shyampatadia

Description


🐞 Bug Report: driver.WindowHandles does not detect new tab opened by link or script in Selenium 4.26.0 (C#/.NET)

Summary:
In Selenium WebDriver version 4.26.0 for .NET (C#), the driver.WindowHandles property intermittently fails to detect new browser tabs opened via anchor links (target="_blank") or JavaScript triggers. This behavior was not observed in previous versions and leads to NoSuchWindowException errors when switching to a newly opened tab using known working methods.


💻 Environment:

Component Version
Selenium WebDriver 4.26.0
Language Binding C# (.NET)
Browser Google Chrome (latest)
ChromeDriver Matches browser version
OS Windows 10 / 11

Expected Behavior:

After clicking a link that opens a new tab (e.g., target="_blank"), driver.WindowHandles should contain both the original and new tab window handles. Calling SwitchTo().Window() with the correct handle should allow switching between them.


Actual Behavior:

driver.WindowHandles continues to return only one handle, even after a second tab is visibly opened. This causes tab-switching logic based on partial window title or handle to fail.



Reproducible Code

Use the `driver.WindowHandles` method when 2 tabs are opened, on a browser, it returns me only one handle, and not 2.

ℹ️ Last known working version: 4.26.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!C-dotnet.NET BindingsD-chromeI-defectSomething is not working as intendedI-regressionSomething was working but we "fixed" itOS-windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions