Merge pull request #828 from exviva/actually_memoize
Actually memoize the attributes of a Selenium node
This commit is contained in:
commit
888d1b9d36
|
@ -5,7 +5,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](name)
|
def [](name)
|
||||||
@attrs = {}
|
@attrs ||= {}
|
||||||
@attrs[name] ||= native.attribute(name.to_s)
|
@attrs[name] ||= native.attribute(name.to_s)
|
||||||
rescue Selenium::WebDriver::Error::WebDriverError
|
rescue Selenium::WebDriver::Error::WebDriverError
|
||||||
nil
|
nil
|
||||||
|
|
Loading…
Reference in New Issue