Permalink
Browse files

Refactor Capybara::Selenium::Node#[] and Capybara::Selenium::Node#value

  • Loading branch information...
agibralter committed Apr 28, 2011
1 parent f027541 commit eef139ff487ed9fcf61ab03dac35fb605ebbd069
Showing with 3 additions and 7 deletions.
  1. +3 −7 lib/capybara/selenium/node.rb
@@ -4,20 +4,16 @@ def text
end
def [](name)
- if name == :value
- value
- else
- native.attribute(name.to_s)
- end
+ native.attribute(name.to_s)
rescue Selenium::WebDriver::Error::WebDriverError
nil
end
def value
if tag_name == "select" and self[:multiple] and not self[:multiple] == "false"
- native.find_elements(:xpath, ".//option").select { |n| n.selected? }.map { |n| n.attribute('value') || n.text }
+ native.find_elements(:xpath, ".//option").select { |n| n.selected? }.map { |n| n[:value] || n.text }
else
- native.attribute('value')
+ native[:value]
end
end

0 comments on commit eef139f

Please sign in to comment.