Skip to content

Is there a way to set site permissions? #376

Closed

Description

@brian-kephart

Thanks for this great library!

My specific use case for altering site permissions is that I am testing a subscription workflow for push notifications, and I would like to test the user experience when the value of Notification.permission is "default", "granted", or "denied".

# in headless mode
browser.evaluate("Notification.permission") # => "denied"

# in non-headless mode
browser.evaluate("Notification.permission") # => "default"

I'm wondering if there is a way to set this value to "granted", or to modify site permissions in general. I could not find anything relevant to this in the README, the code, or the command line args.

Activity

  1. route commented on Jul 13, 2023

    @route
    Member

    @brian-kephart hey, you could try set permissions with https://chromedevtools.github.io/devtools-protocol/tot/Browser/#method-grantPermissions

    browser.command("Browser.grantPermissions", permissions: ['notifications'], origin: 'https://example.com')
    

    If that works please leave feedback or maybe send a PR ;)

  2. locked and limited conversation to collaborators on Jul 13, 2023
  3. converted this issue into a discussion #377 on Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions