-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Selenium Testing Tools Cookbook Second Edition
By :
While developing tests in Ruby, we can use the page-object gem to implement the Page Object model within the tests. The page-object gem provides simple features with which to build the objects of a Page Object, along with Watir WebDriver.
In this recipe, we will see how to use the page-object gem to implement the Page Object model for the BMI Calculator's main page.
You need to download and install the page-object gem with the help of the following command:
gem install page-object
To implement the Page Object model in Ruby using the page-object gem, perform the following steps:
Define a class for the Page Object model by creating a Ruby script with the name of the page. In this example, we will be creating a Page Object model for the main page of the BMI Calculator application and including the page-object module:
require 'page-object'
class BmiCalcPage
include PageObject
text_field(:height...
Change the font size
Change margin width
Change background colour