Sean
Sean

Reputation: 71

How do I switch focus to a new window using Selenium VBA?

So, I know how to find the name of the active window

currentWindow = bot.Send("GET", "/window_handle")
bot.SwitchToWindowByName currentWindow

Is there a way to get the name of the inactive window that I just popped up?

I tried going to console and typing window.name and got "" Also tried using window.document.name and got "download.phtml", but

bot.SwitchToWindowByName download.phtml

gave me a Runtime 424 Object Required error.

Picture of the new window (on the right)

Upvotes: 0

Views: 7077

Answers (1)

QHarr
QHarr

Reputation: 84465

Explicitly with

bot.SwitchToWindowByTitle "Title"  '<==Make sure it is the actual Title you are using of the Window

If it has just popped up you may also try

bot.SwitchToNextWindow

Upvotes: 4

Related Questions