The problem is that the webdriver will still focus on the current browser and not the pop up windows and therefore any interaction will only go to the browser and not to the new pop up browsers.
To solve this simply switch the browser to point to the pop up.
Here is the implementation for selenium webdriver in ruby
def switch_to_new_pop_up
response.driver.browser.switch_to.window
(response.driver.browser.window_handles.last)
end
def close_active_window
response.driver.browser.close
response.driver.browser.switch_to.window
(response.driver.browser.window_handles[0])
end
Hey,
ReplyDeleteVery useful info. THanks. More selenium 2 article please :)