1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Element#inspect should output obsolete elements without raising

This commit is contained in:
Thomas Walpole 2017-03-21 15:34:18 -07:00
parent a542dd9ea2
commit 6a84994376
2 changed files with 15 additions and 0 deletions

View file

@ -374,6 +374,12 @@ module Capybara
%(#<Capybara::Node::Element tag="#{tag_name}" path="#{path}">)
rescue NotSupportedByDriverError
%(#<Capybara::Node::Element tag="#{tag_name}">)
rescue => e
if session.driver.invalid_element_errors.any? { |et| e.is_a?(et)}
%(Obsolete #<Capybara::Node::Element>)
else
raise
end
end
end
end

View file

@ -147,5 +147,14 @@ RSpec.shared_examples "Capybara::Session" do |session, mode|
})
end
end
describe "Element#inspect" do
it "outputs obsolete elements" do
@session.visit('/form')
el = @session.find(:button, 'Click me!').click
sleep 2
expect(el.inspect).to eq "Obsolete #<Capybara::Node::Element>"
end
end
end
end