-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Description
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