Summary
Browser Clickpath Monitors support DOM and CSS locators out of the box. This covers most scenarios, but for some applications, an XPath locator is needed. This article will explain how to select one.
Steps to find the XPath locator
-
Open the relevant page in a Chrome Browser
-
Right-click on the element to be clicked in the Browser clickpath monitor
-
Select Inspect (this will open Dev Tools)
-
Right-click on the element that is highlighted
-
Choose Copy > Copy XPath

Adding an XPath locator into your Monitor
You can either use the XPath locator directly as a locator or use a JavaScript event for clicking.
Steps to add an XPath locator into an existing Click or Keystrokes event
-
Open the Browser Clickpath Monitor> Settings > Recorded clickpath page
-
Open the relevant Click or Keystroke event you would like to update
-
In the Edit element locators section, modify the 1st locator to be DOM type and replace the Input section with
document.evaluate('xpath', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValueReplacing xpath with the XPath captured previously
-
Save changes
Steps to add a JavaScript event to click on XPath locator
-
Open the Browser Clickpath Monitor> Settings > Recorded clickpath page
-
Click Add synthetic event
-
Name the event, select JavaScript from the select synthetic event drop down and pick the event you would like you new event to be added after.
-
Click Add Synthetic event
-
Paste the following snippet into the black box
function getElementByXpath(path) { return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; } a1 = getElementByXpath('xpath'); a1.click(); -
Replace xpath with the XPath captured previously
-
Save changes
What’s Next
If none of the previous steps resolved the issue, open a chat and provide a link to the monitor you’re updating and the configuration steps you have already completed.



