Cucumber step to interact with an iframe using Capybara webdriver
Give your iframe
a name attribute (i.e. <iframe name="myframe">
) and then simply use
When I press "Foo" in the iframe "myframe"
Then I should see "Bar!" in the iframe "myframe"
Step as follows:
Then /^(.*) in the iframe "([^\"]+)"$/ do |step, iframe_name|
browser = page.driver.browser
browser.switch_to.frame(iframe_name)
step(step)
browser.switch_to.default_content
end