diff --git a/lib/capybara/driver/node.rb b/lib/capybara/driver/node.rb index ceaa1f27a..31b1b1f86 100644 --- a/lib/capybara/driver/node.rb +++ b/lib/capybara/driver/node.rb @@ -70,6 +70,10 @@ def inspect rescue NotSupportedByDriverError %(#<#{self.class} tag="#{tag_name}">) end + + def ==(other) + raise NotSupportedByDriverError + end end end end diff --git a/lib/capybara/node/matchers.rb b/lib/capybara/node/matchers.rb index 270cd9e9f..0cf61ec2c 100644 --- a/lib/capybara/node/matchers.rb +++ b/lib/capybara/node/matchers.rb @@ -451,11 +451,7 @@ def has_no_table?(locator, options={}) end def ==(other) - if other.respond_to?(:native) - self.eql?(other) or native == other.native - else - self.eql?(other) - end + self.eql?(other) or base == other.base end private diff --git a/lib/capybara/rack_test/node.rb b/lib/capybara/rack_test/node.rb index afe5725af..c6df2519d 100644 --- a/lib/capybara/rack_test/node.rb +++ b/lib/capybara/rack_test/node.rb @@ -97,6 +97,10 @@ def find(locator) native.xpath(locator).map { |n| self.class.new(driver, n) } end + def ==(other) + native == other.native + end + protected def unnormalized_text diff --git a/lib/capybara/selenium/node.rb b/lib/capybara/selenium/node.rb index 46a33fc8c..a33461aa4 100644 --- a/lib/capybara/selenium/node.rb +++ b/lib/capybara/selenium/node.rb @@ -75,6 +75,10 @@ def find(locator) native.find_elements(:xpath, locator).map { |n| self.class.new(driver, n) } end + def ==(other) + native == other.native + end + private # a reference to the select node if this is an option node