Created
July 19, 2012 05:21
-
-
Save gelias/3140936 to your computer and use it in GitHub Desktop.
Preenchendo um campo do tipo text
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 'watir-webdriver' | |
require 'rspec' | |
describe "Look for browser elements" do | |
FIRST_NAME = 'Guilherme' | |
before(:each) {puts 'inicou'} | |
after(:each) {@firefox.close unless @firefox.nil?} | |
it "Fill first name field" do | |
# Cria uma instancia do firefox e abre o formulário no google docs | |
@firefox = Watir::Browser.new :firefox | |
@firefox.goto 'http://bit.ly/M1mjNB' | |
# Busca o text field conforme o atributo id especificado. Espera ele aparecer na pagina e depois preenche | |
first_name_field = @firefox.text_field(:id => 'entry_0') | |
first_name_field.wait_until_present | |
first_name_field.set FIRST_NAME | |
# Busca o valor digitado e compara | |
filled_name = first_name_field.value | |
filled_name.should == FIRST_NAME | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment