20 Mar 2023 11:44 AM - last edited on 20 Mar 2023 12:39 PM by Ana_Kuzmenchuk
Hello,
I'm looking for a way to trigger a logout of the user used in my Browser Clikpath if any of the steps in the Browser ClickPath fails or goes timeout.
Is this something achievable via Javascript?
Regards,
Yann
Solved! Go to Solution.
20 Mar 2023 01:21 PM
If you there's something on the page you want to check for you can use a JavaScript event to check for the existence/ not of something and then either conitue or skip the next steps up to the log out. This solution would only work in certain scenarios though. If the previous event failed for any reason the monitor would still end without running the log out steps.
What is the purpose of needing to log out at the end of your execution? Does it affect future executions? If so, you could add in a check at the beginning of your script to check if the user was already logged in, and if so, either skip the login steps or perform some steps to log the user out and then continue with the login.
21 Mar 2023 07:21 AM - edited 21 Mar 2023 07:22 AM
Hello Hannah and thanks for your quick reply and trying to better understand my case 🙂
In general I have only one Account that cannot make concurrent session. If I run session in parallel one of the two will get a pop-up message that another session is currently being made.
For this reason I'm implementing an automatic solution with the OnDemand Synthetic Api that will execute in a fashion waterfall way the Synthetic browser monitors (one after the other, only when the previous has finished).
That being said: if, while running, at whatever step, the Synthetic #1 fail -the account will remain logged. The Synthetic #2 will fail since at the first attempt of logging in it will have a pop-up reminding that another session is currently being made with that same Account. In real session I could still go forward by agreeing to continue with the current session (excluding the previous)
I also have to think aboutDEM consumption, so the best solution will be the one that makes consume less and works as expected 😄
The logout if whatever step failed seemed like a good start without knowing if it was possible or not.
I'll look into your suggestion (Checking from the beginning of a Synthetic Browser if a session is currently running, if so skip for the current one instead of "Skip to a logout if any of the step are in failed condition for any reason")
Regards,
Yann
21 Mar 2023 09:25 AM
I have applied your solution via js and it applies smoothly. After the login step a js will check the page and make decision based on the contnent.
What is not clear to me is if I can make a single js that supervise every and each step inside the Browser Clickpath.
21 Mar 2023 11:01 AM
If you would like to check for the correct page at each event, you would need to add JS events at each point you wanted to check.
Since you are using the API to run these monitors, perhaps you could take a different path. You could check if the monitor was successful or not before running the next execution/ monitor, and if the previous execution failed have another monitor that you run first that just logs the user out
21 Mar 2023 11:12 AM
I think I'll stop here in order to focus on the rest of the script/orchestration solution. Thank you for every advice, have a great day!