Defining a new constant
Tasks in your page object classes often interact
with objects, such as
div
and anchor
tags,
and form elements, on the storefront. The Storefront Test Automation
Engine is designed to find these objects using their ID, Class Name,
XPath, or other attributes which are encoded in the source of the
page. The Aurora store was developed such that each object on the
storefront as and many other HTML nodes have unique object IDs. These
unique object IDs are stored in each Page Object file. These Ids can
be used only in the page objects, and should not be directly called
from the Test Scripts.Procedure
- Determine the object ID for the object you want to define.
- Using Mozilla Firefox:
- Start Firefox and browse to the starter store that uses the object.
- When the store home page is loaded, click the Firebug icon in the lower right side of the Firefox window.
- In the Firefox console, ensure that the HTML tab is selected.
- Click Click an element in the page to inspect to enable the ability to lock on to an object.
- Click the object that you want to define to lock on to it.
- Select the HTML tab in the Firebug console. The HTML source code of the object is highlighted.
- Using Microsoft® Internet
Explorer:
- Start Internet Explorer and browse to the starter store that uses the object.
- Click .
- Select the HTML tab. The HTML source code of the object is highlighted.
- Click the Select Element by Click (the cursor icon) to enable the ability to lock on to an object.
- Click the object that you want to define to lock on to it.
- Using Mozilla Firefox:
- Define the object ID in the Page Object
file.
Results
A new constant is created for a previously undefined object. You can reference the constant in your Page Objects as needed.