<?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>topic Re: Synthetic Browser Monitor - Javascript Step Issue in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170428#M901</link>
    <description>&lt;P&gt;Hi Roberto,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try to add following for the step which is just before your JavaScript code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, please try to add wait time for your JavaScript snippet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AK_0-1628251938770.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/1840iB34311E508D2E0AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AK_0-1628251938770.png" alt="AK_0-1628251938770.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;AK&lt;/P&gt;</description>
    <pubDate>Fri, 06 Aug 2021 12:13:49 GMT</pubDate>
    <dc:creator>AK</dc:creator>
    <dc:date>2021-08-06T12:13:49Z</dc:date>
    <item>
      <title>Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170394#M900</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having an issue while executing a javascript piace of code in my synthetic test: what I would like to do is to check the presence of an element and then skip a synthetic event in base of the result.&lt;BR /&gt;This is the code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var check_string = document.querySelector("body &amp;gt; form &amp;gt; table &amp;gt; tbody &amp;gt; tr &amp;gt; td &amp;gt; table.cornice &amp;gt; tbody &amp;gt; tr &amp;gt; td.label2");
if (check_string !== null) {
api.skipSyntheticEvent(8);
} else {
api.skipSyntheticEvent(9);
}
api.finish();&lt;/LI-CODE&gt;&lt;P&gt;I'm sure that the target window is the correct one.&lt;BR /&gt;The problem is that the test fail with this message:&amp;nbsp;&lt;SPAN&gt;1601 - JS execution took too long&lt;/SPAN&gt;&lt;BR /&gt;What does it mean? If I run this javascript snippet on a framework it works fine without errors.&lt;BR /&gt;&lt;BR /&gt;Thanks for any help!&lt;/P&gt;&lt;P&gt;Roberto&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 18:09:44 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170394#M900</guid>
      <dc:creator>roberto_ravo</dc:creator>
      <dc:date>2021-08-05T18:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170428#M901</link>
      <description>&lt;P&gt;Hi Roberto,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try to add following for the step which is just before your JavaScript code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, please try to add wait time for your JavaScript snippet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AK_0-1628251938770.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/1840iB34311E508D2E0AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AK_0-1628251938770.png" alt="AK_0-1628251938770.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;AK&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 12:13:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170428#M901</guid>
      <dc:creator>AK</dc:creator>
      <dc:date>2021-08-06T12:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170436#M902</link>
      <description>&lt;P&gt;Hi AK,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've already done it but it seems that the snippet works fine if it found the element present in the querySelector,&amp;nbsp;while if it doesn't find it, the message "&lt;SPAN&gt;JS execution took too long"&amp;nbsp;&lt;/SPAN&gt;appears.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Roberto&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 14:56:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170436#M902</guid>
      <dc:creator>roberto_ravo</dc:creator>
      <dc:date>2021-08-06T14:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170457#M903</link>
      <description>&lt;P&gt;Well, I'm not able to replicate the issue. However, I tested both the conditions (element present and not present) on my environment and for both scenarios my monitor ran successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the results,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code snippet (added ".innertext" get innertext of element if have any and info API call to show element content in replay log)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AK_2-1628277111752.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/1848i322E381120BBF7CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AK_2-1628277111752.png" alt="AK_2-1628277111752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Dummy JavaScript steps were added as step no. 10 and step no. 11.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Condition 1 - Element present&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AK_0-1628276489880.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/1846i553B13AD67FC529B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AK_0-1628276489880.png" alt="AK_0-1628276489880.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Condition 2 - Element not present&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AK_1-1628276873084.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/1847i141C5AB2E0AC5453/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AK_1-1628276873084.png" alt="AK_1-1628276873084.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I would like understand the issue in more details like,&lt;/P&gt;&lt;P&gt;Is the element you are looking for, will sometimes presents and sometimes not?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;AK&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 06:49:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170457#M903</guid>
      <dc:creator>AK</dc:creator>
      <dc:date>2021-08-09T06:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170490#M904</link>
      <description>&lt;P&gt;Hello AK,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for the feedback.&lt;/P&gt;&lt;P&gt;So, in the details my test do a login initially and&amp;nbsp;the default window is window[0] . Window[1] is opened when the user wants to logoff.&lt;BR /&gt;But there is another situation: if the session end without logoff correctly, at the next login an extra window opened with a message that says that another session was opened and the precedent was closed with the new login. So, it could be possible that in some runs there will be 3 total window that we must take care.&lt;BR /&gt;In a normal situation, the window[1] is the one where the user must interact to logoff and in this page is configured the check write in the JS snippet.&lt;BR /&gt;But like I write before, is possible that the window[1] have another content and so the check will find nothing and in this case must do the operation provided in the "else" condition.&lt;BR /&gt;I know that is a little bit weird, but is going to be difficult to handle this situation.&lt;BR /&gt;&lt;BR /&gt;P.S: the test at the moment works fine if the check is executed on the page where the querySelector found the element. Is not working in the other situation.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;Roberto&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 07:19:23 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170490#M904</guid>
      <dc:creator>Lazaro</dc:creator>
      <dc:date>2021-08-09T07:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170537#M905</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Roberto,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Two things here,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. If end/real users also facing "session end without logoff correctly" (issue) and that is an expected behavior then I would suggest to raise support ticket and have working session with them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. If that is not an expected behavior and "unsuccessful logout" caused you to write a JavaScript checks in monitor then, I had similar use case where click on Logout button (during replay) never worked and we came to following resolution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--&amp;gt;&lt;/STRONG&gt; Assuming that, the application calling sessionID in logout URL - Capture the sessionID from any previous steps and add a navigation&amp;nbsp;step for logout URL (appending sessionID to logout URL)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Note:-For some applications, calling just logout URL may work.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;AK&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 18:14:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170537#M905</guid>
      <dc:creator>AK</dc:creator>
      <dc:date>2021-08-09T18:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170605#M906</link>
      <description>&lt;P&gt;HI AK,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've already opened a support ticket and I'm waiting for some feedback. Calling the logout URL is a good trick but I've tried also this without success.&lt;BR /&gt;I will wait the support for further analisys about this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Roberto&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 06:31:05 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170605#M906</guid>
      <dc:creator>Lazaro</dc:creator>
      <dc:date>2021-08-11T06:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170630#M907</link>
      <description>&lt;P&gt;Hi AK,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to call the logout URL, but I think that I must add some header field. You think that is possibile to do this with browser monitor?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Roberto&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 13:28:44 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170630#M907</guid>
      <dc:creator>Lazaro</dc:creator>
      <dc:date>2021-08-11T13:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170714#M912</link>
      <description>&lt;P&gt;Hi Roberto,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know how your application gets logged out. However, below worked for me,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Get the session ID&lt;/STRONG&gt;&lt;BR /&gt;I checked on chrome developer tool for session ID which I found under "action" attribute of one form (It could be anywhere on the page)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var GetID = document.forms.namedItem("GenericForm").getAttribute("action");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Further&amp;nbsp;processing using&amp;nbsp;&lt;A href="https://www.w3schools.com/jsref/jsref_replace.asp" target="_self"&gt;&lt;STRONG&gt;JavaScript string replace function&lt;/STRONG&gt;&lt;/A&gt;&amp;nbsp;to get only session ID value,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var ID= GetID.replace(/\/do\/client;jsessionid=/g, "");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Store the session ID value&lt;/STRONG&gt;&lt;BR /&gt;There is an API in dynatrace (api.setValue) which can be used to store the values and we can use that stored values anywhere in the monitor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;api.setValue("ID", ID);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. Use the session ID as parameter in calling URL (Logout)&lt;/STRONG&gt;&lt;BR /&gt;Add navigation step with sessionid as a parameter in the calling URL like below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://abc.xyz/do/logout;sessionid={ID}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Screen grabs,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AK_2-1628777417957.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/1905i71F8B02C846CD4C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AK_2-1628777417957.png" alt="AK_2-1628777417957.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AK_1-1628776971363.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/1903i5E5A53B6419F56A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AK_1-1628776971363.png" alt="AK_1-1628776971363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let me know if that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;AK&lt;/P&gt;</description>
      <pubDate>Thu, 12 Aug 2021 16:49:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170714#M912</guid>
      <dc:creator>AK</dc:creator>
      <dc:date>2021-08-12T16:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170768#M915</link>
      <description>&lt;P&gt;Hello AK,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;understood your solution.&amp;nbsp;In my case I'm finding the JSESSIONID only in the response header, but as I can see is not so easy to parse a generic header values.(I'm not a javascript expert &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Roberto&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 07:10:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170768#M915</guid>
      <dc:creator>Lazaro</dc:creator>
      <dc:date>2021-08-13T07:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Browser Monitor - Javascript Step Issue</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170908#M926</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;In the end the support help me to handle this issue by&amp;nbsp;adding the Javascript code to change the Logout form target attribute from another window('esci') to '_top' and it can able to perform the Logout option on first window itself.&lt;BR /&gt;I think that is a good approach!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for yours suggestions!&lt;BR /&gt;Bye!&lt;BR /&gt;Roberto&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2021 10:07:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/Synthetic-Browser-Monitor-Javascript-Step-Issue/m-p/170908#M926</guid>
      <dc:creator>Lazaro</dc:creator>
      <dc:date>2021-08-18T10:07:24Z</dc:date>
    </item>
  </channel>
</rss>

