Cucumber / Selenium: Access and test document title

Posted . Visible to the public.

If you want to test that a certain text is contained within the document title of your page, you can do so using Selenium and a step such as

Then /^"(.*?)" should be shown in the document title$/ do |expectation|
  title = page.driver.browser.title
  title.should include(expectation)
end
Profile picture of Thomas Eisenbarth
Thomas Eisenbarth
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Thomas Eisenbarth to makandra dev (2014-01-07 17:00)