K6 browser set allow-scripts permission

We ran some tests using k6 browser and we got the following error multiple times:

ERRO[0009] Blocked script execution in ‘about:blank’ because the document’s frame is sandboxed and the ‘allow-scripts’ permission is not set. browser_source=security line_number=6 source=browser stacktrace=“&{ [0xc000f4dec0 0xc000f4df00 0xc000f4df40 0xc001176100 0xc001176180 0xc0011761c0 0xc001176200 0xc001176240 0xc001176280 0xc0011762c0 0xc001176340 0xc001176380 0xc001176400 0xc001176440] }” url=“https://cdn.cookielaw.org/scripttemplates/202404.1.0/otBannerSdk.js

It is very annoying as it is difficult to follow other diagnostic logs. Is there a way to set allow-scripts permission in order to avoid it?

1 Like


This might be related to what is explained in this document.

You can also try running the k6 browser like this:

K6_BROWSER_ARGS='allow-scripts' k6 run script.js

Hope this helps.


Hi @inancgumus

I appreciate your reply. I tried your solution and code works like a charm.

This K6 env var was very deeply hidden.


1 Like