-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[🐛 Bug]: Switch to window is not working after Chrome/Edge browser update version to 133 #15318
Comments
@AlokB1993, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Hi @AlokB1993 , I can't reproduce this behaviour with both Selenium 4.23 and latest 4.29, if you could provide an example that reproduces the above behaviour for you, that would be great. I am using the below script: using System;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
class Program
{
static void Main()
{
IWebDriver driver = new ChromeDriver();
try
{
driver.Navigate().GoToUrl("https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open");
string parentHandle = driver.CurrentWindowHandle;
// Click a button that opens a new window
driver.SwitchTo().Frame("iframeResult");
driver.FindElement(By.TagName("button")).Click();
var allHandles = driver.WindowHandles;
driver.SwitchTo().Window(allHandles[1]);
Console.WriteLine("Title after switching: " + driver.Title);
Thread.Sleep(1000);
driver.Close();
driver.SwitchTo().Window(parentHandle);
Console.WriteLine("Title after switching back: " + driver.Title);
}
catch (Exception e)
{
Console.WriteLine("Exception occurred: " + e.Message);
}
finally
{
driver.Quit();
}
}
} And getting the output:
which is correct and no exception is thrown. |
Here's an issue on chromedriver that may relate to this. Since version 133, there's an issue where, if you have extensions installed or are opening a pdf, an additional window handle is generated. |
This is reproducible when opening a PDF in a new tab through the current page. I see that 2 handles are being created for opening a single PDF which is resulting in this error - So, in total 3 handles are present - 0, 1, 2 with (1) being the "blank" handle, if we switch to (2) handle - |
This works fine with Firefox, it generates only 1 handle when opening the PDF in new tab. |
Hi @navin772, I agree with you. Even I have tried in my system with simple code for handling multiple window and it works. However in my project which is running from many years (it was working in older browser versions) it stopped working and when i downgrade the browser version to 132 there it's working fine. I will try to create a small repo for you how the things are happening there. |
Hi @navin772 , I tried to get some sample code to clarify the issue much better for you. This is a working code till 132 browser version. please let us know if there is a new issue or there is any solution we need to update our code. Session.Driver.GetDriver().WindowHandles; // Got 2 winids before saving the popup public virtual bool IsOpened() // Session.Driver.ExecuteScript("return document.title;") code launching blank browser and i'm getting only 1 winid which is new
} |
Hi @AlokB1993, as mentioned earlier, I think this is a chromedriver issue, let's wait for the fix. |
Any updates here or advice on which version of chromedriver we should use? |
What happened?
Steps:
Expected: Driver focus should go to parent window.
Actual: Its opening a new blank window and throwing the exception "No such window"
How can we reproduce the issue?
Relevant log output
Its opening a new blank window and throwing the exception "No such window"
Operating System
win10
Selenium version
c#, selenium 4.23
What are the browser(s) and version(s) where you see this issue?
Chrome 133 and Edge 133
What are the browser driver(s) and version(s) where you see this issue?
Selenium manager
Are you using Selenium Grid?
No
The text was updated successfully, but these errors were encountered: