Cucumber step to interact with an iframe using Capybara webdriver

Updated . Posted . Visible to the public.

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
Profile picture of Tobias Kraze
Tobias Kraze
Last edit
Keywords
selenium
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2012-09-26 14:41)