Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'selenium-webdriver'
- browser = Selenium::WebDriver.for :firefox
- browser.get "http://localhost/page5"
- wait = Selenium::WebDriver::Wait.new(:timeout => 15)
- cb = browser.find_element(:name, "checkthebox")
- # Check that the checkbox exists
- cb = wait.until {
- element = browser.find_element(:name, "checkthebox")
- element if element.displayed?
- }
- puts "Test Passed: The check box exists" if cb
- # Check the checkbox
- cb.click
- # Verify the state of checkbox
- puts "Test Passed: The check box is selected now" if cb.selected? == true
- sleep 2
- # Un-Check the checkbox
- cb.click
- # Verify the state of checkbox again
- puts "Test Passed: The check box is unselected now" if cb.selected? == false
- browser.quit
Advertisement
Add Comment
Please, Sign In to add comment