Cannot Activate/SwitchTo "ActiveWindow" #113
-
Here is how to reproduce this issue:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @GHRyunosuke, Yeah, the Selenium WebDriver does not recognize a tab that is created manually as the active window (although it still aware of the newly created window) - I would call it a limitation as opposed to a bug. So the first (non-manually created) window is still the active window as far as the WebDriver is concerned. An alternative to using Dim driver As WebDriver
Dim oldWindow As WebWindow
Set driver = New WebDriver
driver.StartChrome
driver.OpenBrowser
driver.NavigateTo "http://the-internet.herokuapp.com/windows"
Set oldWindow = driver.ActiveWindow
Stop 'create a new tab manually
driver.Windows.SwitchToNext 'make the new window the active one
oldWindow.SwitchTo 'now switch back to the old one
'also following will work too if you only have two open windows
'driver.Windows.SwitchToNext 'make the new window the active one
'driver.Windows.SwitchToNext 'now switch back to the old one
driver.Wait 3000
driver.Shutdown |
Beta Was this translation helpful? Give feedback.
Hi @GHRyunosuke,
Yeah, the Selenium WebDriver does not recognize a tab that is created manually as the active window (although it still aware of the newly created window) - I would call it a limitation as opposed to a bug. So the first (non-manually created) window is still the active window as far as the WebDriver is concerned. An alternative to using
driver.Windows.SwitchToByUrl
anddriver.ActiveWindow.Url
is the following: