<?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 perform a click event using Javascript on browser clickpath synthetic monitors in Troubleshooting</title>
    <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/ta-p/244503</link>
    <description>&lt;DIV class="lia-message-template-content-zone"&gt;
&lt;DIV&gt;&lt;EM&gt;This article shows how to trigger click events with JavaScript during a synthetic browser monitor execution. It explains supported scripting methods and provides examples for selecting elements and invoking clicks.&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;H2&gt;Summary&lt;/H2&gt;
&lt;P&gt;In some scenarios, a recorded click event doesn't work during recorder playback, and this may be because the relevant element needs a combination of events to complete an action.&amp;nbsp;We can verify the Event Listeners from Developer tools and try with associated events.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Solution&lt;/H2&gt;
&lt;P&gt;Steps to follow to perform the needed events for a click action on browser clickpath synthetic monitor&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;Go to the relevant page on Chrome browser&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Right-click on the element that you want to interact with on the page-&amp;gt; Inspect the element, which will open the developer tools&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Inspect.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19580i323BF3A358BE80E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Inspect.jpg" alt="Inspect.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Verify the Event Listeners(Right Side of Developer tools) and confirm if the relevant element has event listeners(Like Click, Mouseover, Pointerdown)&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Event Listeners.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19581i0C3AA0BF9695E7F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Event Listeners.jpg" alt="Event Listeners.jpg" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Right click on the element on the Web developer tools - &amp;gt; Copy - &amp;gt; Copy JS path&lt;/P&gt;
&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Copy JS Path.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19584i1D38DFBF2682040A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Copy JS Path.jpg" alt="Copy JS Path.jpg" /&gt;&lt;/span&gt;&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Paste the JS path on the below element value and add this JavaScript code into the JavaScript Event of your Browser click path monitor&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Add JS event.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19583i51245B71ED533363/image-size/large?v=v2&amp;amp;px=999" role="button" title="Add JS event.jpg" alt="Add JS event.jpg" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;function triggerevent(element)
{

 var parameters1 = {    isTrusted: true,    pressure: 0.5,    type: "pointerdown",    bubbles: true,    cancelable: true,    cancelBubble: false  };
 var parameters2 = {    isTrusted: true,    bubbles: true,    cancelable: true,    cancelBubble: false  };
 
 var evt1 = new PointerEvent("pointerdown", parameters1);
 element.dispatchEvent(evt1);
 var evt2 = new PointerEvent("pointerup", parameters1);
 element.dispatchEvent(evt2);
 var evt3 = new MouseEvent("mouseup", parameters2);
 element.dispatchEvent(evt3);
 var evt4 = new MouseEvent("click", parameters2);
 element.dispatchEvent(evt4);
 
}

var element = document.querySelector("#layout-inner &amp;gt; dt-common-navigation").shadowRoot.querySelector("nav &amp;gt; nav &amp;gt; ul &amp;gt; li:nth-child(9) &amp;gt; a");
triggerevent(element);&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Update the script to call the relevant events.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/DIV&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 and this article.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;What to read next:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-ccp-props="{&amp;quot;134233117&amp;quot;:false,&amp;quot;134233118&amp;quot;:false,&amp;quot;335559738&amp;quot;:299,&amp;quot;335559739&amp;quot;:299}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HannahM_0-1769597412466.png" style="width: 25px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/31774i68AEB8E7215FBD19/image-dimensions/25x25?v=v2" width="25" height="25" role="button" title="HannahM_0-1769597412466.png" alt="HannahM_0-1769597412466.png" /&gt;&lt;/span&gt;&lt;SPAN data-ccp-props="{&amp;quot;134233117&amp;quot;:false,&amp;quot;134233118&amp;quot;:false,&amp;quot;335559738&amp;quot;:240,&amp;quot;335559739&amp;quot;:240}"&gt;&lt;A id="link_6" class="page-link lia-link-navigation lia-custom-event" 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;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jan 2026 10:50:52 GMT</pubDate>
    <dc:creator>Mareeswaran</dc:creator>
    <dc:date>2026-01-28T10:50:52Z</dc:date>
    <item>
      <title>How to perform a click event using Javascript on browser clickpath synthetic monitors</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/ta-p/244503</link>
      <description>&lt;DIV class="lia-message-template-content-zone"&gt;
&lt;DIV&gt;&lt;EM&gt;This article shows how to trigger click events with JavaScript during a synthetic browser monitor execution. It explains supported scripting methods and provides examples for selecting elements and invoking clicks.&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;H2&gt;Summary&lt;/H2&gt;
&lt;P&gt;In some scenarios, a recorded click event doesn't work during recorder playback, and this may be because the relevant element needs a combination of events to complete an action.&amp;nbsp;We can verify the Event Listeners from Developer tools and try with associated events.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Solution&lt;/H2&gt;
&lt;P&gt;Steps to follow to perform the needed events for a click action on browser clickpath synthetic monitor&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;Go to the relevant page on Chrome browser&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Right-click on the element that you want to interact with on the page-&amp;gt; Inspect the element, which will open the developer tools&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Inspect.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19580i323BF3A358BE80E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Inspect.jpg" alt="Inspect.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;Verify the Event Listeners(Right Side of Developer tools) and confirm if the relevant element has event listeners(Like Click, Mouseover, Pointerdown)&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Event Listeners.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19581i0C3AA0BF9695E7F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Event Listeners.jpg" alt="Event Listeners.jpg" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Right click on the element on the Web developer tools - &amp;gt; Copy - &amp;gt; Copy JS path&lt;/P&gt;
&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Copy JS Path.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19584i1D38DFBF2682040A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Copy JS Path.jpg" alt="Copy JS Path.jpg" /&gt;&lt;/span&gt;&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Paste the JS path on the below element value and add this JavaScript code into the JavaScript Event of your Browser click path monitor&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Add JS event.jpg" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19583i51245B71ED533363/image-size/large?v=v2&amp;amp;px=999" role="button" title="Add JS event.jpg" alt="Add JS event.jpg" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;function triggerevent(element)
{

 var parameters1 = {    isTrusted: true,    pressure: 0.5,    type: "pointerdown",    bubbles: true,    cancelable: true,    cancelBubble: false  };
 var parameters2 = {    isTrusted: true,    bubbles: true,    cancelable: true,    cancelBubble: false  };
 
 var evt1 = new PointerEvent("pointerdown", parameters1);
 element.dispatchEvent(evt1);
 var evt2 = new PointerEvent("pointerup", parameters1);
 element.dispatchEvent(evt2);
 var evt3 = new MouseEvent("mouseup", parameters2);
 element.dispatchEvent(evt3);
 var evt4 = new MouseEvent("click", parameters2);
 element.dispatchEvent(evt4);
 
}

var element = document.querySelector("#layout-inner &amp;gt; dt-common-navigation").shadowRoot.querySelector("nav &amp;gt; nav &amp;gt; ul &amp;gt; li:nth-child(9) &amp;gt; a");
triggerevent(element);&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Update the script to call the relevant events.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/DIV&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 and this article.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="auto"&gt;What to read next:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-ccp-props="{&amp;quot;134233117&amp;quot;:false,&amp;quot;134233118&amp;quot;:false,&amp;quot;335559738&amp;quot;:299,&amp;quot;335559739&amp;quot;:299}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HannahM_0-1769597412466.png" style="width: 25px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/31774i68AEB8E7215FBD19/image-dimensions/25x25?v=v2" width="25" height="25" role="button" title="HannahM_0-1769597412466.png" alt="HannahM_0-1769597412466.png" /&gt;&lt;/span&gt;&lt;SPAN data-ccp-props="{&amp;quot;134233117&amp;quot;:false,&amp;quot;134233118&amp;quot;:false,&amp;quot;335559738&amp;quot;:240,&amp;quot;335559739&amp;quot;:240}"&gt;&lt;A id="link_6" class="page-link lia-link-navigation lia-custom-event" 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;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jan 2026 10:50:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/ta-p/244503</guid>
      <dc:creator>Mareeswaran</dc:creator>
      <dc:date>2026-01-28T10:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform click event with help of Javascript on browser click path synthetic monitor incase of recorded click event not</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/244731#M661</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/40562"&gt;@Mareeswaran&lt;/a&gt;&amp;nbsp;, thank you for your suggestion. I have tried replacing all the CSS locators with DOM and it works during replay but is there anyway we could set up Dynatrace to capture the DOM locators by default (instead of CSS) while recording a flow?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 07:05:16 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/244731#M661</guid>
      <dc:creator>shalnw</dc:creator>
      <dc:date>2024-05-03T07:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform click event with help of Javascript on browser click path synthetic monitor incase of recorded click event not</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/245038#M665</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/75349"&gt;@shalnw&lt;/a&gt;&amp;nbsp; Unfortunately, we don't have way to make the synthetic recorder&amp;nbsp;&lt;SPAN&gt;to capture the DOM locators by default and we need to inspect &amp;amp; add the DOM locators manually.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 05:05:00 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/245038#M665</guid>
      <dc:creator>Mareeswaran</dc:creator>
      <dc:date>2024-05-08T05:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform click event with help of Javascript on browser click path synthetic monitor incase of recorded click event not</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/245039#M666</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/40562"&gt;@Mareeswaran&lt;/a&gt;&amp;nbsp;, I have added the DOM locators/ events and the screenshots to my recording. The playback click path replays the expected flow and the screenshots are correct. But when I go to Analyse executions to view results, it shows just the website's homepage. Is this inconsistency expected for Shadow DOM events?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 05:25:13 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/245039#M666</guid>
      <dc:creator>shalnw</dc:creator>
      <dc:date>2024-05-08T05:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform click event with help of Javascript on browser click path synthetic monitor incase of recorded click event not</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/245040#M667</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/75349"&gt;@shalnw&lt;/a&gt;&amp;nbsp; Yes.&amp;nbsp;&lt;SPAN&gt;If the application uses the shadowDOM elements, Dynatrace Synthetic Recorder extension not supported for recording the shadowDOM elements.&amp;nbsp; You can refer the community article for that&amp;nbsp;&lt;A class="" href="https://community.dynatrace.com/t5/Troubleshooting/How-to-inspect-and-add-the-shadow-DOM-elements-into-synthetic/ta-p/209228" target="_blank" rel="noopener"&gt;How to inspect and add the shadow DOM elements into synthetic script events.&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 05:14:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/245040#M667</guid>
      <dc:creator>Mareeswaran</dc:creator>
      <dc:date>2024-05-08T05:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a click event using Javascript on browser clickpath synthetic monitors</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/289070#M1016</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I tried out this JS script method and currently encountering the error "&lt;SPAN&gt;Playback error: Exception was thrown by the JavaScript code: Cannot read properties of null (reading 'shadowRoot')."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kenyu216_0-1762283745911.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30814i1A9D64DD7147B0DD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kenyu216_0-1762283745911.png" alt="kenyu216_0-1762283745911.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'm not sure what I am missing here.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 19:16:23 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/289070#M1016</guid>
      <dc:creator>kenyu216</dc:creator>
      <dc:date>2025-11-04T19:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a click event using Javascript on browser clickpath synthetic monitors</title>
      <link>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/289811#M1021</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/49354"&gt;@kenyu216&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that target window may be different one and that is the reason its unable to identify the selector. You can inspect the element and check if there is any iframe are available. If so, you need to use the relevant target window like&amp;nbsp;ruxitWin[0].frames[0]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mareeswaran_0-1763541795116.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30932iB8D7CCAD6EDEA75D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Mareeswaran_0-1763541795116.png" alt="Mareeswaran_0-1763541795116.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Nov 2025 08:43:09 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Troubleshooting/How-to-perform-a-click-event-using-Javascript-on-browser/tac-p/289811#M1021</guid>
      <dc:creator>Mareeswaran</dc:creator>
      <dc:date>2025-11-19T08:43:09Z</dc:date>
    </item>
  </channel>
</rss>

