In Selenium, support "<input type='search'/>" etc.

This commit is contained in:
Bernerd Schaefer and Tim Pope 2010-06-16 15:06:20 -05:00 committed by Pairing Workstation Sears
parent 46962e1278
commit 88d58ce991
2 changed files with 4 additions and 5 deletions

View File

@ -25,13 +25,13 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
end
def set(value)
if tag_name == 'textarea' or (tag_name == 'input' and %w(text password hidden file).include?(type))
node.clear
node.send_keys(value.to_s)
elsif tag_name == 'input' and type == 'radio'
if tag_name == 'input' and type == 'radio'
node.click
elsif tag_name == 'input' and type == 'checkbox'
node.click if node.attribute('checked') != value
elsif tag_name == 'textarea' or tag_name == 'input'
node.clear
node.send_keys(value.to_s)
end
end

View File

@ -53,7 +53,6 @@ shared_examples_for "fill_in" do
end
it "should fill in a field with a custom type" do
pending "selenium doesn't seem to find custom fields" if @session.mode == :selenium
@session.fill_in('Schmooo', :with => 'Schmooo is the game')
@session.click_button('awesome')
extract_results(@session)['schmooo'].should == 'Schmooo is the game'