Skip to content
Scott Clark edited this page Oct 12, 2015 · 17 revisions

When included, the LitePage module defines a constructor on the class, which takes a browser instance and stores it in an instance variable named @browser. It also extends the class with the LitePage::ElementFactory module and defines a page_url class method, which accepts a string representing the url for the page and defines a new page_url instance method that returns the url. The page_url instance method optionally accepts a hash of query parameters which will be appended to the returned url.

Examples:

class LoginPage
  include LitePage
  page_url('http://www.example.com/login')
end

browser = Watir::Browser.new
page = LoginPage.new(browser)

page.page_url
# => 'http://www.example.com/login'

page.page_url(:newuser => true)
# => 'http://www.example.com/login?newuser=true'
Clone this wiki locally