I am looking to write a simple selenium test that will find a window with a title or URL and then select it, then select swap tabs once. I have tried using various things like
driver.SwitchTo().Window(handle);
I have managed to write this function in Powershell, but because I cannot identify the Chrome window with Powershell I read that Selenium was the best way to go. I am using Visual Studio and have installed all the Chrome Drivers and everything.
No, you can't locate a window with a specific title
or URL
and then use it to switch tabs.
The current top-level browsing context is represented in the protocol by its associated window handle. A top-level browsing context can be selected using the Switch To Window
command as follows :
driver.SwitchTo().Window(windowHandle);
You can find a detailed discussion in What is the difference between WebDriver.SwitchTo().Window() and WebDriver.SwitchTo().Frame()