Skip to content
snowe2010 edited this page Mar 25, 2013 · 7 revisions

The PageObject module adds several methods to your page object. The methods that are added follow a fairly similar pattern. Let's take a look at a few of the methods and their generated output.

The call to text_field like this one

text_field(:first_name, :id => 'fname')

will produce the following four methods

first_name             # return the value in the text field
first_name=            # set the value in the text field
first_name_element     # return the text field element
first_name?            # checks the existence of the element

There is one special purpose generator method that does not follow this pattern. When you call the page_url method

page_url 'http://www.google.com'

it will produce a method named goto

goto  # navigate to the url that was specified in the page_url

To see all of the methods available and what methods they will generate you can read the documentation for the Accessors module here.