I have the following lines in my feature file:
Given I have website "www.google.co.uk" When I click the website "www.google.co.uk" Then "www.google.co.uk" page is opened in a new window I am struggling to find a way to test that the webpage is definately opened in a new window.
Currently I have been using this in my step def:
Then /url "([^"]*)" is opened in new window/ do |url| browser = page.driver.browser current_id = browser.window_handle tab_id = page.driver.find_window(url) browser.switch_to.window tab_id page.driver.browser.close browser.switch_to.window current_id end but this still passes the test if the webpage is loaded on the same page, I want it to fail if the webpage is loaded on the same window/tab.
Any suggestions?
Many thanks