Test Case Elements Indentifiers

Syntax in order to identify a field or element inside a page has the form :

identifier=html_reference

identifier can take the various values :

  • id=

id of the field will be used.

Example 1. id= html example

<ul class="list-group step-list side-item nav nav-pills" id="steps" style="max-height: 600px;overflow-y: auto">

id=steps
  • name=

Example 2. name= html example

<a name="menu" id="menuLabel" href="Label.jsp">Label</a>

name=menu
  • class= .class= html example

<label class="checkbox"></label>

class=checkbox
  • css=

  • xpath=

You can specify an xpath value. Additional documentation on xpath syntax can be found here. Xpath can be tested live on Web pages from Chrome Developer extention (accessible via F12).

Via Element tab, you just have to hit CTRL+F in order to find inside the DOM.

XPath Chrome Console

In the search field, typing the xpath will point you to the element.

XPath Chrome Console

XPath can also be tested from the console tab.

XPath Chrome Console

Just type

$x("//div");

And it will report the Element found. [] is returned in case no element are found.

XPath Chrome Console

Example 3. by Path
xpath=//*[@id='html_reference']
  • link=

  • data-cerberus=

Example 4. data-cerberus= html example

<label data-cerberus="label-OK"></label>

data-cerberus=label-OK
  • coord=

  • picture=

This identifier will use the image recognition engine to find the element pixel by pixel. That will only work for FAT Applications (Sikuli) or GUI in hybrid mode (using Sikuli extention)

Example 5. by picture example that will click on application object buttonOK
picture=%object.buttonOK.pictureurl%

In order to perform any action/control (e.g. 'click', 'verifyElementPresent'), Application Object must be used to reference picture. Keep in mind that for click action, it will be performed in the center of the picture: SikuliClick1

  • text=

This identifier will use the OCR engine of the image recognition capability to find the element pixel by pixel. That will only work for FAT Applications (Sikuli) or GUI in hybrid mode (using Sikuli extention)

Example 6. by text example
text=save my preferences
  • erratum=

Use the Erratum feature in order to get the element. That works in GUI applications. That algorithm guess the correct xpath from pages that could change over time. Please see more details on erratum project page. Erratum syntax is :

erratum=<full xpath>,<html page full content>
Example 7. erratum= example
erratum=/html/body/button,   <!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <title>JSP Page</title>         <script type="text/javascript" src="../dependencies/jQuery-2.2.3/jquery-2.2.3.min.js"></script>              </head>     <body>                  <button id="erratumButton">Errratum</button>     </body> </html>

In order to collect the erratum syntax, you need to use Cerberus Google Chrome extention.

  • querySelector=

This identifier is used on websites that use shadowDOM pages (eg : Salesforce).

Example 8. querySelector= example
querySelector=iron-component-page>>iron-doc-viewer>>a
  • OTHER

Note

If no indentifier is defined, Cerberus will either consider that it is an id or an xpath if it starts by // (most xpath does start by //). That behaviour allows to copy/paste from Cerberus to any other tools without being forced to add or remove xpath=.