I have a link that opens in a new window, and I need to test the part of my app that is within that new window.
Any suggestions will be much appreciated.
I have a link that opens in a new window, and I need to test the part of my app that is within that new window.
Any suggestions will be much appreciated.
Could you just validate that the link has it's target set to _blank?
Define a step that contains this code:
page.driver.browser.switch_to.window (page.driver.browser.window_handles.last)
switch_to is a selenium command that allows you to change over to a new window window_handles returns a list of currently open windows
I realize this is a very old post, but here's a Cucumber step definition using Capybara and the Poltergeist driver:
And /^I follow "([^"]*)" to the new window$/ do |link|
new_window = window_opened_by { click_link link }
switch_to_window new_window
end