问题
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)
回答1:
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
来源:https://stackoverflow.com/questions/52397268/how-do-i-switch-focus-to-a-new-window-using-selenium-vba