You can customize the clickable elements that can be recorded during scenario recording. The script to modify is located in the following directory:
Chrome: UserCustomizableOptions.js script in the <INSTALL>/plugins/com.parasoft.ptest.libs.web_<VERSION>/root/browsers/chrome/
directory.The following array variables defined in the UserCustomizableOptions.js script are used during recording:
ext.options.clickableAttributes
Clicking on HTML elements that are set with an attribute type defined in this variable will be recorded. For example, onclick
is used to initiate script execution and is a good candidate in this array.
ext.options.clickableTags
Clicking on HTML tags defined in this variable will be recorded. In an Ajax web application, for instance, there are cases in which tags, such as <span>
or <li>
trigger functionalities on the client side when clicked.
ext.options.clickableInputTypes
Clicking on form input types defined in this variable will be recorded. Types, such as text
and textarea
are not clickable by default because the user usually clicks on it just to gain focus and enter text.
ext.options.structuralTags / ext.options.containerTags
These variables limit the scope of user actions recorded against elements. User actions are not recorded for elements named in the ext.options.structuralTags
variable if those elements have at least one child element (either direct or indirect) specified in the ext.options.containerTags
variable.
For example, click actions on <div>
elements are normally recorded, but sometimes those elements are used as containers for other elements. For example, a <div>
may contain a table, which contains many other elements. You can configure the variables to not record click actions if you do not want to record click actions against divs used as containers for tables:
ext.options.structuralTags = [ "div", "span" ]; ext.option.containerTags = [ "table", "ul" ];
ext.options.disallowedTags
This variable contains a list of tags that will never be recorded, even if they satisfy other recording criteria.
ext.options.locatorBuildersOrder
This variable defines the order used for creating locators. Locators identify the HTML element at which the user action takes place and are needed during playback to repeat user actions. The default order is constructed such that visual attributes in an element are more favorable when creating the locator:
ext.options.locatorBuildersOrder = [ 'link', // Look for links text. e.g. link=SOAtest will find <a href..>SOAtest</a> 'visibleFormElementText', // Use visible text connected to form elements 'text', // Use text that appears within the element to locate the element 'id', // Use the id attribute to locate the element 'name', // Use the name attribute to locate the element 'linkXPath', // Use a relative XPath that checks for img alt text or contains a string in the link text 'attributesXPath', // Use a relative XPath that checks for various attributes in the element 'attributesXPathWithIndex', 'positionXPath' // An XPath that may be a relative or complete (no attributes are used) ];
Enable debugging information to find out which locator builder is used. Choose Parasoft > Preferences > Browser and enable Print debugging information. In the following example, the id
builder is used:
Locator - /descendant::img[@id='changeing'][1]. Used id builder.
See Browser Settings for more information about this option.
ext.options.preferredAttributesOrder
This field is used by the locator attributesXPath
and attributesXPathWithIndex
builders (see ext.options.locatorBuilders.order). When invoked, this array determines the preferred attributes used. You can add, remove, or reorder attribute names to this array to better customize the locators that get built for elements on your site. Removing an attribute will prevent it from being used by the aforementioned locator builders (which may be important if you know certain attributes on your web page are dynamic and should never be used). Re-ordering the attributes will change the priority of the attributes. The first attributes of the array, like 'id', take precedence to be used in locators over the last elements.
ext.options.displayDialogs
Set this variable to true
to display alert, confirmation, and prompt dialogs during playback. Allowing these dialogs to display during playback requires the user to close the dialogs. The close action can be automated (such as with an AutoIT script).
ext.options.xpathLibrary
You can use this variable to specify an XPath library for resolving XPath locators used in web scenarios. This option has three possible values:
ajaxlt
: Uses the Google Ajaxlt XPath implementation: http://code.google.com/p/ajax-slt/wgxpath
: Uses the Wicked Good XPath implementation at https://github.com/google/wicked-good-xpathdefault
: Uses the default implementation (currently, Wicked Good XPath)