Skip to content

Instantly share code, notes, and snippets.

@tourdedave
Created June 3, 2013 14:21
Show Gist options
  • Save tourdedave/5698489 to your computer and use it in GitHub Desktop.
Save tourdedave/5698489 to your computer and use it in GitHub Desktop.
A Selenium WebDriver example of how to access elements within a nested frame.
require 'selenium-webdriver'
require 'rspec-expectations'
def setup
@driver = Selenium::WebDriver.for :firefox
end
def teardown
@driver.quit
end
def run
setup
yield
teardown
end
run {
@driver.get 'http://the-internet.herokuapp.com/frames'
@driver.switch_to.frame('frame-top')
@driver.switch_to.frame('frame-middle')
@driver.find_element(id: 'content').text.should =~ /MIDDLE/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment