In this article we will learn how to generate XPaths or CSS Selectors using one or more attributes.

Refer to <Create UI Identifier manually> to learn the other options available to create UI Identifier.


Navigation: Test Development > UI Identifiers


On the  UI Identifiers page, click on Create button to start creating the UI Identifier.





Enable the Select to create checkbox. The Advanced Options reveals as shown below:





1. Select the respective radio button for creating XPath or CSS Selector.


2. Enter the values as shown below:

  • Target Element: Select HTML Element Type from the drop-down box. This is mostly the tag name of the HTML Element. Possible tag names are link, image, textbox, heading, list, button, date selectors e.t.c.
  • Attribute: Select Attribute from the drop-down box. Attributes are properties of the HTML Element such as id, name, title e.t.c.
  • Operator: Select Operator from the drop-down box. An operator determines how the given value compares with the actual Attribute value for the Element. It can be one of Equals, Starts with, or Contains.
  • Value: Enter the value to be compared with the actual Attribute value. 


Note: You may also use different Test Data Types to make it dynamic. Please check the below guide to know more about creation of dynamic UI Identifiers using Test Data:
Creation of Dynamic Xpath using Parameter Test Data
Creation of Dynamic Xpath using Runtime Parameter Test Data


Note: We can use the Developer Tools in your Google Chrome or Firefox browser to get the values for Element Type, Attribute and Value. Please check the following article for more details on using developer Tools to get the Attribute name and Attribute value of an Element - How to get UI Identifier using Inspect Element option in Chrome Developer Tools?


3. Click on the plus icon on right to add more attributes.


4. Repeat the above steps 2 and 3 to add multiple attributes as shown below:



5. Tick the attributes that you need to include and click on Generate to get the final value.




Note: Here's the same attributes with CSS Selector. You may edit and switch the selector type when you want.




6. Finally, click on Create button to create the UI Identifier. You can see the success notification with newly created UI Identifier and you will be taken to the UI Identifiers page.