diff --git a/lib/capybara/node/simple.rb b/lib/capybara/node/simple.rb index 2a97b813..4197ac1b 100644 --- a/lib/capybara/node/simple.rb +++ b/lib/capybara/node/simple.rb @@ -146,7 +146,7 @@ module Capybara end def title - native.xpath("//title").first.text + native.title end def inspect diff --git a/lib/capybara/rack_test/browser.rb b/lib/capybara/rack_test/browser.rb index 3c6ba8d9..a26c3c23 100644 --- a/lib/capybara/rack_test/browser.rb +++ b/lib/capybara/rack_test/browser.rb @@ -96,7 +96,7 @@ class Capybara::RackTest::Browser end def title - dom.xpath("//title").text + dom.title end protected diff --git a/lib/capybara/spec/session/title_spec.rb b/lib/capybara/spec/session/title_spec.rb index 951587dc..cfb7d61c 100644 --- a/lib/capybara/spec/session/title_spec.rb +++ b/lib/capybara/spec/session/title_spec.rb @@ -1,13 +1,13 @@ Capybara::SpecHelper.spec '#title' do - it "should print the title of the page" do + it "should get the title of the page" do @session.visit('/with_title') expect(@session.title).to eq('Test Title') end context "with css as default selector" do before { Capybara.default_selector = :css } - it "should print the title of the page" do + it "should get the title of the page" do @session.visit('/with_title') expect(@session.title).to eq('Test Title') end diff --git a/lib/capybara/spec/views/with_title.erb b/lib/capybara/spec/views/with_title.erb index 6b64b921..770ca26f 100644 --- a/lib/capybara/spec/views/with_title.erb +++ b/lib/capybara/spec/views/with_title.erb @@ -1 +1,4 @@ -