You can configure the way Parasoft Recorder records UI actions by specifying the locator strategies and attributes used. These configurations can also be shared with other users through a simple export/import model.

Configuring UI Actions

Configuring UI Actions for Parasoft Recorder entails setting locator strategies and attributes. You can reorder their hierarchy, enable or disable locator strategies, and add or remove attributes. Note that, at any time after configuring these options, you can revert back to the default configuration by clicking Reset in the toolbar.

  1. Right-click the extension in the Google Chrome toolbar and choose Options. The Configuration page opens.
  2. Choose the Configure UI Actions for Selenic tab from the Options tree at the left.
  3. Locator strategies are listed at the top of the page. For more information about these locator strategies, see the table below

    You can:
    • Toggle any of them on or off with their respective sliders.
    • Drag and drop a locator strategy to another position in the list to reorder the list.
    • Hover over the info icon next to a locator strategy to learn more about it.
  4. Attributes are listed at the bottom of the page.

    These attributes are used by the Attribute and Attribute Index locator strategies. You can add, remove, or reorder attribute names to better customize the locators which get built for elements on your website:
    • Remove an attribute by clicking its respective Remove ( – ) icon.
    • Drag and drop an attribute to another position in the list to reorder the list.
    • Add a new attribute by clicking the Add ( + ) icon at the bottom of the list. This will create an empty text box; enter the name of the attribute you want to add. 
  5. If you want to save your changes, click Save.
  6. If you want to discard your changes, click Cancel.

Locater Strategies

The following table describes the locator strategies you can employ:

NameDescription
Button Text

Locates a button used in a form, matching on the button's text.

Examples:

  1. css selector: input[value='push me']
  2. xpath: descendant::input[@value="push me"]
Text

Locates an element by its text content. Builds a "link text" or "partial link text" locator for a hyperlink, otherwise builds an "xpath" locator.

Examples:

  1. link text: click me
  2. partial link text: click
  3. xpath: descendant::div[normalize-space(.)="The quick brown fox"]
Name

Locates an element by its "name" attribute. Builds a "name" locator. Builds "xpath" and "css selector" locators for substring matches.

Examples:

  1. name: foo
  2. css selector: [name$='foo']
  3. xpath: descendant::*[ends-with(@name, "foo")]
Input Label

Locates an input by creating an XPath (css not supported) using a label that is associated with that input.

Examples:

  1. <input> anywhere on the page and label has for="inputId" attribute
    xpath: //input[@id=//label[normalize-space()="User Name"]/@for]
  2. <input> as the following-sibling of the <label>
    xpath: //label[normalize-space()="User Name"]/following-sibling::input
  3. only one <input> sibling of the <label> but not necessarily following
    xpath: //*[label[normalize-space()="User Name"]]/input
  4. <input> as a child element inside the <label>
    xpath: //label[normalize-space()="User Name"]/input
ID

Locates an element by its "id" attribute. Builds an "id" locator. Builds "xpath" and "css selector" locators for substring matches.

Examples:

  1. id: foo
  2. css selector: [id^='foo']
  3. xpath: descendant::*[starts-with(@id, "foo")]
Class

Locates an element by its "class" attribute. Builds a "class name" locator. Builds "xpath" and "css selector" locators for substring matches.

Examples:

  1. class name: some-class
  2. css selector: [class*='foo']
  3. xpath: descendant::*[contains(@class, "foo")]
Table

Locates an element in a table. The row and column are identified by some unique criteria, falling back on indices.

Example:
  xpath: //table/tbody/tr[td[1][normalize-space()=\"Phone #:\"]]/td[2]/input

Link Image

Locates a hyperlink that contains an image with a particular "alt" attribute.

Example:
  xpath: descendant::a[img/@alt="logo"]

Attribute

Locates an element by matching one or more attributes in the order defined below. If the element cannot be uniquely identified by any single attribute, also matches on the tag name and two or more attributes.

Examples:

  1. css selector: button[value='foo'][title='bar']
  2. xpath: descendant::button[@value="foo" and @title="bar"]
Parent

Locates an element by using an ancestor element as the context and creating a compound locator. The locator that is created could be a combination of locators for multiple ancestor elements.

Examples:

  1. css selector: .parent-class .child-class
  2. xpath : /descendant::*[@title='Save']/descendant::span[normalize-space(.)='Save']

This strategy increases analysis time for recommendations.

Text IndexLocates an element by its text content and index relative to other elements with that same text content on the page.
Attribute IndexLocates an element by matching one or more attributes in the order defined below and an index relative to other elements with the same attribute value on the page.
Position

Locates an element by its position in the document.

Examples:
tag name: input

  1. css selector: div:first-of-type > input:nth-of-type(2)
  2. xpath: //div[1]/input[2]

Exporting and Importing UI Actions Configuration

You can export the UI Actions configuration from Chrome on one machine and import them into another. The export creates a JSON file that can be easily shared and imported.

To export a configuration file, click Export and choose a location to save the JSON file. To import a configuration file, click Import and browse to the location of the JSON file. The file can be on a local or network drive.

  • No labels