Skip to content
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Watir Page Helper

This is a ruby gem that assists in creating page model abstractions for maintainable browser automation.

It provides helper methods to allow expressive and easy access to elements.


Simply define a page such as:

require 'watir-webdriver'
require 'watir-page-helper'

class MyPage
  include WatirPageHelper

  direct_url ''
  expected_element :text_field, :name => 'q'
  expected_title 'Google'
  text_field :search_box, :name => 'q'
  button :search, :name => 'btnG'

  def initialize browser, visit = false
    @browser = browser
    goto if visit

    expected_element if respond_to? :expected_element
    has_expected_title? if respond_to? :has_expected_title?

This page can now be used in rspec specs, cucumber features or in isolation

browser = :chrome
page = browser, true
page.search_box = 'Watirmelon' #This method is created by
WatirPageHelper #This method is created by WatirPageHelper also


This documentation is open source, and a work in progress. If you find it incomplete or confusing, please submit an issue, or, better yet, a pull request.

Something went wrong with that request. Please try again.