Read more

Cucumber step to interact with an iframe using Capybara webdriver

Tobias Kraze
September 26, 2012Software engineer at makandra GmbH

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"
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

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
Posted by Tobias Kraze to makandra dev (2012-09-26 16:41)