Solved

Embedded cookie pop-up - How handle?

  • 5 April 2024
  • 3 replies
  • 22 views

Hi,

I have an issue. We have a portal with an embedded cookie pop-up. I have implemented a test in Tosca which (if the cookie pop-up appears) clicks on the "Accept all" button. But that doesn´t work if the cookie pop-up not appears. Do you have an idea to keep the test running if the cookie pop-up does not appear?

 

 

 

Case if the cookie popup does not appear:

Could not find HtmlDocument 'Buffer Cookie window exists' with the following properties:
- Title: *TITLE
The Browser could not be found. Please check if you have opened the browser and prepared it according to the documentation.

 

icon

Best answer by PriyankaSharma 5 April 2024, 17:03

View original

3 replies

Userlevel 1

Please move the step “Buffer Cookie window exists” to the IF Condition, before the Tbox Evaluation Tool.

And to be more precise, you can remove the step Tbox Evaluation Tool. Inside IF Condition, in the step “Buffer Cookie window exists”, just verify Exists == True (change ActionMode to Verify, and update value as .Exists==True)

Userlevel 3
Badge +1

Please move the step “Buffer Cookie window exists” to the IF Condition, before the Tbox Evaluation Tool.

And to be more precise, you can remove the step Tbox Evaluation Tool. Inside IF Condition, in the step “Buffer Cookie window exists”, just verify Exists == True (change ActionMode to Verify, and update value as .Exists==True)

In general, buffering the .Exists value first and using TBox Evaluation Tool should actually be the more reliable method. I’ve found that putting the verification inside the Condition (whether it’s part of an If, Do, or While) opens you up to cases where the Condition fails for reasons other than the one you intended, and then the flow of your test may not proceed as you want it to.

@fw205568 have you observed the behaviour closely when the popup doesn’t appear? If you run the step by itself in the Scratchbook, does it work? The error suggests the browser isn’t open, so I wonder if there is some extra delay in loading the non-popup page or something like that. If so you might need some kind of WaitOn (for an element that will always exist on the page regardless of the popup) first. 

Depending on what you need to test - you might want to consider running all your tests in incognito / inprivate mode, as that would likely mean you get the cookie popup either 100% or 0% of the time so can eliminate the If statement and give yourself better control over the behaviour of the test.

 @PriyankaSharma and @brendon.russell :

Thank you very much for the answers and advices. With the switch of “ Buffer Cookie window exists “ into the if-condition it works very reliably and stable!

Reply