Need help with the following scenario,

In a website, OneTrust cookies are implemented. The cookies are from an external company. The cookie solution is implemented by including a couple of references to the OneTrust CDN, which loads javascript to the page that shows the cookies. The Header data is as expected.

I have automation tests using Selenium and C# to check for the presence of cookie banner and accept cookies.

When I run the automation, the page does not display the cookie banner. Where as, banner shows during manual testing.

The chrome dev tools showed 403 error and found that a JSON response in one of the cookie related JavaScript file is not getting loaded and is within the OnTrust code. This is happening always and the automation tests are failing in Azure pipeline.

But sometimes these tests are passing in my local machine.

Is there any way to overcome this? Is there a possibility to add the JSON content during the automation run, like, when I open the url and I add the JSON content?

Thank you for your time.

  • have you tried changing the user agent ? or ading a wait for cookie banner to be displayed
    – PDHide
    Oct 13 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.