Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Permission Granting for Storage Access API #31227

Closed
BausPhi opened this issue Jun 10, 2024 · 0 comments · Fixed by #31239
Closed

[Feature]: Permission Granting for Storage Access API #31227

BausPhi opened this issue Jun 10, 2024 · 0 comments · Fixed by #31239
Assignees
Labels

Comments

@BausPhi
Copy link

BausPhi commented Jun 10, 2024

🚀 Feature Request

Web applications can utilise the Storage Access API to get unpartitioned access to third-party cookies across different websites. When the Storage Access API is used to request this unpartitioned access for the first time, browsers will show a permission dialog to the user in order to accept or deny the storage-access. To my knowledge, automating the permission grant and, as a result, resolving the permission dialog is currently not possible in Playwright (I could not find a permission value in the documentation to automatically grant this permission to sites). Therefore, I would suggest adding a permissions value that can be used to automate granting the storage-access permission to websites.


Sources Storage Access API:

Example

The feature can be used to grant the storage-access permission to websites without manually resolving the permission dialog in the browser. The following code is an example how the feature could look like to automatically grant the permission to websites:

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  
  // Granting the storage-access permission to the context
  const context = await browser.newContext({
    permissions: ["storage-access"]
  });

  await context.close();
  await browser.close();
})();

Motivation

During automated testing, encountering permission dialogs disrupt the test flow and require manual interaction, which defeats the purpose of automation. By enabling automatic storage-access permission granting and resolving the permission dialog, Playwright can provide a more seamless and efficient testing experience for websites using the Storage Access API.

Additionally, with all major browsers transitioning to storage partitioning, the Storage Access API has become the sole method for utilising third-party cookies across different websites. Without the ability to automatically grant this permission, it is impossible to perform the automated testing of websites using third-party cookies in a real-world scenario where the user would grant the storage-access permission to the website.

@yury-s yury-s self-assigned this Jun 10, 2024
@yury-s yury-s added the v1.46 label Jun 10, 2024
yury-s added a commit to yury-s/playwright that referenced this issue Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants