<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to add an XPath locator in a Browser Clickpath Monitor script in Troubleshooting</title>
    <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/ta-p/214051</link>
    <description>&lt;H2&gt;Summary&lt;/H2&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-TOC indent="15" liststyle="disc" maxheadinglevel="3"&gt;&lt;/LI-TOC&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Steps to find the XPath locator&lt;/H2&gt;
&lt;OL&gt;
&lt;LI&gt;Open the relevant page in a Chrome Browser&lt;/LI&gt;
&lt;LI&gt;Right-click on the element to be clicked in the Browser clickpath monitor&lt;/LI&gt;
&lt;LI&gt;Select Inspect (this will open Dev Tools)&lt;/LI&gt;
&lt;LI&gt;Right-click on the element that is highlighted&lt;/LI&gt;
&lt;LI&gt;Choose Copy &amp;gt; Copy XPath&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Find XPath" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/12081i50146D0B26555C71/image-size/large?v=v2&amp;amp;px=999" role="button" title="XPath2.gif" alt="Find XPath" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Find XPath&lt;/span&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;Adding an XPath locator into your Monitor&lt;/H2&gt;
&lt;P&gt;You can either use the XPath locator directly as a locator or use a JavaScript event for clicking.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Steps to add an XPath locator into an existing Click or Keystrokes event&amp;nbsp;&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;Open the Browser Clickpath Monitor&amp;gt; Settings &amp;gt; Recorded clickpath page&lt;/LI&gt;
&lt;LI&gt;Open the relevant Click or Keystroke event you would like to update&lt;/LI&gt;
&lt;LI&gt;In the &lt;SPAN&gt;&lt;SPAN&gt;Edit element locators section, modify the 1st locator to be DOM type and replace the Input section with&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;LI-CODE lang="markup"&gt;document.evaluate('xpath', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue&lt;/LI-CODE&gt;Replacing xpath with the XPath captured previously&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HannahM_0-1716288368098.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20000i1C2942696BE6D8C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HannahM_0-1716288368098.png" alt="HannahM_0-1716288368098.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;Save changes&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Steps to add a JavaScript event to click on XPath locator&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;Open the Browser Clickpath Monitor&amp;gt; Settings &amp;gt; Recorded clickpath page&lt;/LI&gt;
&lt;LI&gt;Click Add synthetic event&lt;BR /&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HannahM_1-1685964760907.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/12073i78D719FACD146723/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HannahM_1-1685964760907.png" alt="HannahM_1-1685964760907.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;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.&amp;nbsp;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HannahM_2-1685965369721.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/12075i2510D06A457988C6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HannahM_2-1685965369721.png" alt="HannahM_2-1685965369721.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;Click Add Synthetic event&lt;/LI&gt;
&lt;LI&gt;Paste the following snippet into the black box&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;function getElementByXpath(path) {
    return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}

a1 = getElementByXpath('xpath');
a1.click();​&lt;/LI-CODE&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HannahM_3-1685965562886.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/12076i620814D8E01A8652/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HannahM_3-1685965562886.png" alt="HannahM_3-1685965562886.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;Replace xpath with the XPath captured previously&lt;/LI&gt;
&lt;LI&gt;Save changes&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2 id="toc-hId--526228148"&gt;What's Next&lt;/H2&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;Related reading&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":open_book:"&gt;📖&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;A class="" href="https://community.dynatrace.com/t5/Troubleshooting/Synthetic-Troubleshooting-Map/ta-p/250426" target="_blank" rel="noopener"&gt;Synthetic Troubleshooting Map&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":open_book:"&gt;📖&lt;/span&gt;&amp;nbsp; &lt;A href="https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring/browser-monitors/configure-browser-monitors" target="_self"&gt;Configure Browser Monitors&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":open_book:"&gt;📖&lt;/span&gt;&amp;nbsp; &lt;A href="https://docs.dynatrace.com/docs/observe/digital-experience/synthetic-monitoring/browser-monitors/browser-clickpath-events#javascript" target="_self"&gt;Browser Monitor JavaScript events&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Apr 2026 12:09:07 GMT</pubDate>
    <dc:creator>HannahM</dc:creator>
    <dc:date>2026-04-27T12:09:07Z</dc:date>
    <item>
      <title>How to add an XPath locator in a Browser Clickpath Monitor script</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/ta-p/214051</link>
      <description>&lt;P&gt;&lt;LI-TOC indent="15" liststyle="disc" maxheadinglevel="2"&gt;&lt;/LI-TOC&gt;&lt;/P&gt;
&lt;DIV class="lia-message-template-content-zone"&gt;
&lt;P&gt;*&lt;EM&gt;Use a table of contents for longer articles.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;H1&gt;Summary&lt;/H1&gt;
&lt;P&gt;&lt;EM&gt;*This is a mandatory section.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Short description of which part of the Dynatrace platform the article refers to and what kind of problem it will help resolve / task it will describe.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;Problem&lt;/H1&gt;
&lt;P&gt;&lt;EM&gt;*This is a mandatory section.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Provide a precise description of the problem / task to be described.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;Troubleshooting steps&lt;/H1&gt;
&lt;P&gt;&lt;EM&gt;*This section can be omitted.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;Resolution&lt;/H1&gt;
&lt;P&gt;&lt;EM&gt;*This section can be omitted for ticket‑creation articles.&lt;/EM&gt;&lt;/P&gt;
&lt;H1&gt;What's next&lt;/H1&gt;
&lt;P&gt;&lt;EM&gt;*This is a mandatory section.&lt;/EM&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 27 Apr 2026 12:09:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/ta-p/214051</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2026-04-27T12:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an XPath locator in a Browser Clickpath Monitor script</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/214507#M252</link>
      <description>&lt;P&gt;Great Write up thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/1433"&gt;@HannahM&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 18:53:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/214507#M252</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-06-08T18:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an XPath locator in a Browser Clickpath Monitor script</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/221704#M291</link>
      <description>&lt;P&gt;I know that the post is very old but Could you tell me how to implement a condition if the by chance the object (dropdown) has not been load on the page to throw an exception, please?&lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2023 15:34:13 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/221704#M291</guid>
      <dc:creator>daniel_severino</dc:creator>
      <dc:date>2023-08-27T15:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an XPath locator in a Browser Clickpath Monitor script</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/221902#M292</link>
      <description>&lt;P&gt;Could you add a javascript event and check if the resource loaded as expected?&lt;/P&gt;
&lt;PRE class="c-mrkdwn__pre" data-stringify-type="pre"&gt;performance.getEntriesByName("&lt;A class="c-link" href="https://mc.internal.dynatrace.com/opcon/fonts/bernina/BerninaSans-Web-Light.woff" target="_blank" rel="noopener noreferrer" data-stringify-link="https://mc.internal.dynatrace.com/opcon/fonts/bernina/BerninaSans-Web-Light.woff" data-sk="tooltip_parent"&gt;https://domain.com/fonts/bernina/BerninaSans-Web-Light.woff&lt;/A&gt;")[0].responseStatus&lt;/PRE&gt;
&lt;P&gt;response would be 0 if it hasn't loaded.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 09:13:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/221902#M292</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2023-08-30T09:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an XPath locator in a Browser Clickpath Monitor script</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/221910#M293</link>
      <description>&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;You not only solved my question but also gave me ideas for other questions.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 11:42:04 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/221910#M293</guid>
      <dc:creator>daniel_severino</dc:creator>
      <dc:date>2023-08-30T11:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an XPath locator in a Browser Clickpath Monitor script</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/287559#M995</link>
      <description>&lt;P&gt;Hi team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like the design of the ticketing page has changed slightly which is causing an alert in Dynatrace. We have a synthetic script is flagging an issue with not being able to click on "XXX" but&amp;nbsp; in the new design just shows "YYY" in a circle instead.&amp;nbsp; How Can we adjust the test script for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;B.Mahathi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 10:33:20 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/287559#M995</guid>
      <dc:creator>mborra2</dc:creator>
      <dc:date>2025-10-09T10:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an XPath locator in a Browser Clickpath Monitor script</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/287560#M996</link>
      <description>&lt;P&gt;You'll need to update the script. If it's just the locator that has changed, you can find it using the steps above and then update the relevant event. If the flow of the pages has changed, it may be easier to re-record the script.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 11:11:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-add-an-XPath-locator-in-a-Browser-Clickpath-Monitor/tac-p/287560#M996</guid>
      <dc:creator>HannahM</dc:creator>
      <dc:date>2025-10-09T11:11:46Z</dc:date>
    </item>
  </channel>
</rss>

