Skip to content

Commit

Permalink
Handle selenium webdriver's weird new attributes
Browse files Browse the repository at this point in the history
Whoever came up with the idea of returning "false"
when there is no attribute is deserving of much
hate.
  • Loading branch information
jnicklas committed Oct 22, 2010
1 parent 982280a commit bc3b59c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/capybara/driver/selenium_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def text

def [](name)
if name == :value
native.value
value
else
native.attribute(name.to_s)
end
Expand All @@ -17,10 +17,10 @@ def [](name)
end

def value
if tag_name == "select" and self[:multiple]
if tag_name == "select" and self[:multiple] and not self[:multiple] == "false"
native.find_elements(:xpath, ".//option").select { |n| n.selected? }.map { |n| n.value || n.text }
else
self[:value]
native.value
end
end

Expand Down

0 comments on commit bc3b59c

Please sign in to comment.