Automated web testing

Available element types

  • Unmapped – parameter is not connected to any element of the web page.
  • Text – text element located between various html tags: p, div, td, tr etc.
  • Select – html select (combo-box)
  • Radio – radio button
  • Checkbox – checkbox control
  • Button – html input of type button
  • Page element – universal type that matches any element on web page
  • Delay – a parameter which causes the test to pause for specified amount of time (in seconds)
  • Page URL – URL of the web page
  • Browser – type of browser, which performs the test

The set of possible to use types of elements depends on type of the parameter.
Button and Checkbox are available for boolean type parameters. The choice value defines if the button should be clicked (if the choice value is true).
Type Delay is available for numeric types of parameters.
Types Select, Radio, Page URL and Browser are available for String type parameters.
Page element is available for all types of parameters.

Text can be used as an input parameter to set text in input field or as expected parameter to test the value of text on web page.
Page URL can also be used as input parameter to go to a specified page or as expected parameter to test the actual value of page URL.

Identification of web page element

Two fields labeled Identified by can be used to identify the web element.
For example if we want to identify the following element of the web page:
<p id="label1">Label1</p>, the first field should be set to Id and the second to label1.

Page elements can be identified by:

  • Id (e.g. Id + text1) to map element: <p id="text1">Text1</p>
  • Class Name (Class Name + class2 to map: <div class="class2">Text2</div>)
  • Tag name (TagName + b to map: <b>Text3</b>)
  • Name (Name + text4 to map: <div>Text4</div>)
  • Link text (Link text + Text5 to map: <a href="http://www.google.com">Text5</a>)
  • Partial link text (Partial link text + ext6 to map: <a href="http://www.google.com">Text6</a>)
  • Css selector (mapping in accordance with rules for css selectors – see CSS Selector Reference)
  • Xpath (mapping in accordance with rules for Xpath – see Xpath Reference)

Actions

When we have identified the web element, we can perform specific actions on it. For example we can send keys to a web element of type Text (when it is defined with input tag on web page) in order to modify its value or we can click a button or checkbox.
Element type and whether the parameter is Expected determine the set of available actions.

For example, for Text element type, the possible actions are: ‘send keys’ when the parameter is not expected and ‘check value’ if parameters is expected.
When only one action is possible, the action is not displayed – the field Action remains disabled.
For Check box and Button the available action is ‘click’.
For Browser the available action is ‘set value’.
For Page URL the available action is ‘go to page’ if the parameter is not expected and ‘check page address’ if the parameter is expected.
For universal web element: Page element the set of available actions is Send keys, Click and Submit.
The Submit action can be used on any web page element located inside of <form></form> tag.
Not all actions can be used with each type of element. For example if we locate a text element and then try to ‘click’ it the result will be undefined.