How to deal with a popup window?

45 views
Skip to first unread message

Eser Lin

unread,
Jul 8, 2017, 4:13:56 AM7/8/17
to splinter-users
  When I click a href on a specific website, and evoke a javascript function that pop up another window. But how can I get access to the new window? I just found ways to deal with alert and prompts, and don't know how to deal with popup window.
  The href is like this

  

Blore Buddy

unread,
Jan 8, 2018, 1:11:58 PM1/8/18
to splinter-users
I am assuming browser object is the instance of the Browser() class.
Use the following code:

browser.windows.current = browser.windows[1]

This will make the browser object point to the first popup window. Now you can use the object the way you want it, just like you use it for the main window. 
To make the object point back to the main window again use:

browser.windows.current = browser.windows[0]
Reply all
Reply to author
Forward
0 new messages