Browser automation: how to handle pop-up windows?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Browser automation: how to handle pop-up windows?

Post by madcyborg » Sat Apr 10, 2021 1:53 am

For example, I try to login, and it pops up a new window to type my login information.

I'm using chrome, and it says that the browser is being controlled by automation. But I don't know how to refer to the 2nd window. I tried using SetFocus, but I think I need an ID.

User avatar
Marcus Tettmar
Site Admin
Posts: 7376
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Browser automation: how to handle pop-up windows?

Post by Marcus Tettmar » Wed Apr 14, 2021 3:48 pm

Hi,

See this thread:
viewtopic.php?f=3&t=10716&hilit=switchwindow

You'll find an example with a GetWindowHandles and SwitchWindow subroutine which will allow you to get the window handle of the popup and then switch browsing context to it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts