Archive | August, 2013

Selenium – change windows

23 Aug

Upgraded capybara to 2.1.x (with Selenium Webdriver) and my switch_to window calls started failing.

This is how i fixed it:

sleep(5)
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
within_window(page.driver.browser.window_handles.last) do
   page.should have_content('My Text on New PopUP')
  page.driver.browser.close
end

Seems to take a lot of trial and error when these things break.