checkbox detection

This commit is contained in:
John Bintz 2013-03-14 11:35:05 -04:00
parent d264b5219b
commit 43b965b2b4
1 changed files with 8 additions and 3 deletions

View File

@ -20,8 +20,8 @@ def has_attribute?(name, value)
attribute.text == value
end
def find_input(name)
find("[name$='[#{name}]']")
def find_input(name, additional_search = '')
find("[name$='[#{name}]']#{additional_search}")
end
def set_input(name, value)
@ -30,7 +30,12 @@ def set_input(name, value)
@inputs ||= {}
@inputs[name] = value
input = find_input(name)
input = case value
when true, false
find_input(name, '[type=checkbox]')
else
find_input(name)
end
case input.tag_name.downcase
when 'select'