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/page3"
- wait = Selenium::WebDriver::Wait.new(:timeout => 15)
- # Add text to a text box
- input = wait.until {
- element = browser.find_element(:name, "searchbox")
- element if element.displayed?
- }
- input.send_keys("Information")
- # Check that the form exists
- form = wait.until {
- element = browser.find_element(:name, "input")
- element if element.displayed?
- }
- puts "Test Passed: Form input found" if form.displayed?
- # Click the button based the form it is in (you can also call 'submit' method)
- form.find_element(:name, "submit").click
- browser.quit
Advertisement
Add Comment
Please, Sign In to add comment