XPath Mapping

Modified on Thu, 01 Feb 2024 at 04:06 PM

XPath Overview


XPath is defined as XML path. It is a syntax for finding UI elements on a web page using the XML path expression, commonly known as a locator.

Syntax for XPath

XPath contains the path of the element situated on the web page.
The standard syntax for creating XPath is as follows:


XPath=//tagname[@attribute='value']


This expression is used to identify an element based on its tag name and a specific attribute-value pair. For more information, refer to the article on the Perfecto blog.


Note: In the automation workflow, it's essential to balance the use of both relative and absolute XPaths. However, it is recommended to use relative paths for ease of maintenance.


XPath Mapping 

XPath Mapping is a functionality that allows users to manage and update locators, specifically XPath expressions, associated with UI elements in an application. When there is a change in the application or if a locator is no longer effective, XPath Mapping provides a way to replace or update these locators.

For example, if the existing locator mapped in the Object repository file for an Email ID isn't working after a recent change to an application, then you can perform the following steps:

  1. On the Main Canvas, navigate to the More Menu.
  2.  Choose the XPath Mapping option.

  3. The XPath Mapping screen appears. In this screen, click the 'cloud' icon to upload the scraped file in the CSV format.

    Search functionality: If you have uploaded a large CSV file and wish to search for a required UI element, you can use search functionality.


  4. The following screen displays existing scraped file details from the Object Repository file and uploaded re-scraped file details. In this screen, choose the appropriate UI element name in the CSV file. Select the matching UI element or elements with Control Type displayed in the Object Repository file pane, as shown in the following image.

    Click Remove button on the top-left corner if you wish to replace and add a new scraped file. You can also search for a particular UI element in the search bar.

  5. Click to view the updated locator information and if you wish to remove updated locator information, then click minus icon.
     
  6. Click the icon to view the changes in the Object Repository file.

  7. To access Object Repository file : On the Main Canvas, navigate to Edit Object Repository in the More Menu options to view the updated locator information.













Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article