Skip to content

Cannot Activate/SwitchTo "ActiveWindow" #113

Closed Answered by GCuser99
GHRyunosuke asked this question in Q&A
Discussion options

You must be logged in to vote

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 and driver.ActiveWindow.Url is the following:

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.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@GHRyunosuke
Comment options

Answer selected by GHRyunosuke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants