Created
March 15, 2011 21:55
-
-
Save FabricioFFC/871576 to your computer and use it in GitHub Desktop.
Test using Watir to test a simple captcha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'firewatir' | |
@browser = Watir::Browser.new | |
@browser.goto('http://www.eliasnogueira.info/arquivos_blog/selenium/desafio/soma.php') | |
number1 = @browser.label(:id, 'number1').text.to_i | |
number2 = @browser.label(:id, 'number2').text.to_i | |
sum = number1 + number2 | |
@browser.text_field(:name, 'soma').value = sum | |
@browser.button(:name, 'submit').click | |
@browser.div(:id, 'examp').text | |
if @browser.div(:id, 'examp').text.include? "CORRETO" | |
puts "Parabéns você passou no desafio do @eliasnogueira" | |
else | |
puts "Dah! Você não passou no desafio do @eliasnogueira, tente novamente" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment