Version
1.48.2
Steps to reproduce
Example steps:
- Clone my repo at https://github.com/krokben/sandboxed-iframe
- npm install
- npm run start
- npm run test
- Check for error:
Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set. in the devtools console.
Expected behavior
For it to not throw an error when my website includes an injected iframe with an empty sandbox attribute.
Actual behavior
My page injects an iframe with an empty sandbox attribute. Running this page in the browser throws no error, but in playwright it throws this error:
Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
Additional context
It looks like Playwright tries to run some scripts in all the iframes on the page, which probably leads to this issue. The behavior is then different from what one would expect when just visiting the page in the browser.
I would consider this a bug, but is there maybe some setting I can change in Playwright so that this doesn't happen?
My actual website relies on a third-party plugin that injects these sandboxed iframes, so i cannot influence what their code and add allow-scripts to the sandbox, for example.
Environment
System:
OS: macOS 14.7
CPU: (8) arm64 Apple M1
Memory: 81.13 MB / 8.00 GB
Binaries:
Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
Yarn: 4.1.1 - ~/.nvm/versions/node/v20.15.0/bin/yarn
npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
pnpm: 9.12.3 - ~/.nvm/versions/node/v20.15.0/bin/pnpm
bun: 1.0.29 - ~/.bun/bin/bun
IDEs:
VSCode: 1.94.2 - /usr/local/bin/code
Languages:
Bash: 3.2.57 - /bin/bash
npmPackages:
@playwright/test: ^1.48.2 => 1.48.2
Version
1.48.2
Steps to reproduce
Example steps:
Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.in the devtools console.Expected behavior
For it to not throw an error when my website includes an injected iframe with an empty
sandboxattribute.Actual behavior
My page injects an iframe with an empty
sandboxattribute. Running this page in the browser throws no error, but in playwright it throws this error:Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.Additional context
It looks like Playwright tries to run some scripts in all the iframes on the page, which probably leads to this issue. The behavior is then different from what one would expect when just visiting the page in the browser.
I would consider this a bug, but is there maybe some setting I can change in Playwright so that this doesn't happen?
My actual website relies on a third-party plugin that injects these sandboxed iframes, so i cannot influence what their code and add
allow-scriptsto thesandbox, for example.Environment
System:
OS: macOS 14.7
CPU: (8) arm64 Apple M1
Memory: 81.13 MB / 8.00 GB
Binaries:
Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
Yarn: 4.1.1 - ~/.nvm/versions/node/v20.15.0/bin/yarn
npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
pnpm: 9.12.3 - ~/.nvm/versions/node/v20.15.0/bin/pnpm
bun: 1.0.29 - ~/.bun/bin/bun
IDEs:
VSCode: 1.94.2 - /usr/local/bin/code
Languages:
Bash: 3.2.57 - /bin/bash
npmPackages:
@playwright/test: ^1.48.2 => 1.48.2