cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

browser monitor - js help

jordan_rose
Helper

Hi All, trying to get some help on using a js event in my browser monitor. I am attempting to capture a variable on the screen and use it later but the step ends up failing with "js execution took too long".

 

I have tried several different wait times. With the "wait 5 seconds" option it sits for much longer than 5 seconds before erroring out.

 

I logged into the page > dev tools > right click on the element and chose 'copy js path", then used it in the query selector. I am not 100% about the target window but we never open a new tab/window so left as default.

 

Any help with this is much appreciated as I am not very html savvy.  

 

jordan_rose_0-1656422091485.png

jordan_rose_1-1656422112448.png

 

 

4 REPLIES 4

HannahM
Dynatrace Leader
Dynatrace Leader

Can you try adding the window? If it's the initial one it will be window[0]. Then, can you also print the value of otp, after setting it,  to the vuc-http-custom.log using

api.info("otp: " + otp); 

Hopefully, that will give us a clue as to what's going on . 

Synthetic SME and community advocate.

Hi Hannah, thanks for reply. I notice you cant actually specify window[0] as it just auto resets it back to "optional". I guess it assumes that by default.

 

I added the logging line but it doesnt seem to be writing anything there. The log is empty on both of the synthetic AGs for this env. 

OK, thanks. I think this would be best looked at directly either through chat or a support ticket so we can check your whole script and logs, 

Synthetic SME and community advocate.

Hi Hannah, adding inner.HTML to the end fixed the issue and I can see the log now.

 

var otp = document.querySelector("#content > div > form > fieldset > div:nth-child(3) > div > p:nth-child(3) > b").innerHTML;

 

Thanks for the response/help!

Featured Posts