Automated Test Case fails due "Access ... has been blocked by CORS policy" error message in the browser console

Hi community,

I want to automate a request on our website using Katalon Studio. So I go to the website and click one single button. After clicking this, the browser is loading and loading but doesn’t show any result.
Instead the following error message is displayed when opening the browser console (Chrome):

Access to XMLHTttpRequest at … (redirected from …) from origin … has been blocked by CORS policy:
Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested ressource

I disabled the browsing protection for my Chrome profile but this didn’t work either.

Does anyone has an idea on what I could do?

First, everything you could ever want to know about CORS…

Your webpage is trying to get resources from one or more domains other than the domain where the original page comes from.

CORS is pretty simple when it works, but when you have issues and you need to get into the weeds, then it gets complex pretty quickly.

This link might help, it’s hard to know for sure: javascript - Response to preflight request doesn't pass access control check - Stack Overflow

What happens when you operate the web page by hand?


Hi Russ,

Thank you for the detailed explanation about CORS issues. The reason the button didn’t work, was that while creating the test case I did not specify any further test steps like verify element present …

After adding this test step, Katalon clicked the button and opened the new window.

Still the CORS issue exists, but I could continue with test case automation.

1 Like