support older versions of nokogiri

This commit is contained in:
Thomas Walpole 2015-05-28 12:10:13 -07:00
parent ae2becd025
commit 18019d3cc7
2 changed files with 12 additions and 2 deletions

View File

@ -146,7 +146,12 @@ module Capybara
end
def title
native.title
if native.respond_to? :title
native.title
else
#old versions of nokogiri don't have #title - remove in 3.0
native.xpath('/html/head/title | /html/title').first.text
end
end
def inspect

View File

@ -96,7 +96,12 @@ class Capybara::RackTest::Browser
end
def title
dom.title
if dom.respond_to? :title
dom.title
else
#old versions of nokogiri don't have #title - remove in 3.0
dom.xpath('/html/head/title | /html/title').first.text
end
end
protected