Reputation: 571
I've been doing some dabbling with test automation using Ruby and Watir webdriver...
I am running into an oddity where I open a new window, but when I act upon it, it performs all my actions behind the parent window
Here's how I set it up (using Firefox if that makes a difference):
# opens new window
b.button(:text => 'Upload').click
b.window(:url => 'urlname'). use do
# action performed on the new window
b.select_list(:id => 'selector').select 'Foo'
end
Note: it correctly performs actions on the select list present, but it does this behind the main browser.
Is there something specific I need to write in order for it to remain in front of the main window?
Upvotes: 0
Views: 157
Reputation: 1173
This should work:
b.window(:url => 'urlname').focus
Put that line just after your .use
line, and you should see the new window called to the foreground. You may actually find that you don't end up needing the .use
line (or the do/end
) at all.
Upvotes: 1