- From: jugglinmike <notifications@github.com>
- Date: Thu, 03 Feb 2022 19:56:41 -0800
- To: w3c/permissions <permissions@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/permissions/issues/349@github.com>
Currently, the Automation section defines a WebDriver extension command for "Set Permission," without a corresponding "Get Permission". We deferred specifying such a command because our motivation at the time was enabling automated testing of [powerful features](https://w3c.github.io/permissions/#powerful-feature), so state retrieval was not critical. There are other use cases for automating the Permissions API, though, so we should talk about those and determine if they warrant a new WebDriver command. Based on my current understanding of the typical application developer's use case, a "Get Permission" command may not be necessary. Folks could query the permission status at the granularity of an arbitrary permission descriptor by combining [WebDriver's "Execute Async Script" command](https://www.w3.org/TR/webdriver/#execute-async-script) with [the Permissions API's `query` method](https://w3c.github.io/permissions/#dom-permissions-query). Here's what it could look like in Python: descriptor = {'name': 'camera', 'deviceID': '1234'} status = session.execute_async_script(''' var descriptor = arguments[0]; var done = arguments[1]; navigator.permissions.query(descriptor) .then(function() { return {state: result.state}; }, function(error) { return {error: error.message}; }).then(done); ''') @agouaillard-cosmo has a much clearer understanding of the needs than I, so they can say more about whether this is sufficient. What do you think, Dr. Alex? -- Reply to this email directly or view it on GitHub: https://github.com/w3c/permissions/issues/349 You are receiving this because you are subscribed to this thread. Message ID: <w3c/permissions/issues/349@github.com>
Received on Friday, 4 February 2022 03:56:53 UTC