Skip to content

Commit

Permalink
[py] implement chromium specific endpoint for setting permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 24, 2021
1 parent 73d6bea commit fc05f3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions py/selenium/webdriver/chromium/remote_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, remote_server_addr, vendor_prefix, browser_name, keep_alive=T
RemoteConnection.__init__(self, remote_server_addr, keep_alive, ignore_proxy=ignore_proxy)
self.browser_name = browser_name
self._commands["launchApp"] = ('POST', '/session/$sessionId/chromium/launch_app')
self._commands["setPermissions"] = ('POST', '/session/$sessionId/permissions')
self._commands["setNetworkConditions"] = ('POST', '/session/$sessionId/chromium/network_conditions')
self._commands["getNetworkConditions"] = ('GET', '/session/$sessionId/chromium/network_conditions')
self._commands["deleteNetworkConditions"] = ('DELETE', '/session/$sessionId/chromium/network_conditions')
Expand Down
14 changes: 14 additions & 0 deletions py/selenium/webdriver/chromium/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,20 @@ def delete_network_conditions(self) -> NoReturn:
"""
self.execute("deleteNetworkConditions")

def set_permissions(self, name: str, value: str) -> NoReturn:
"""
Sets Applicable Permission.
:Args:
- name: The item to set the permission on.
- value: The value to set on the item
:Usage:
::
driver.set_permissions('clipboard-read', 'denied')
"""
self.execute("setPermissions", {'descriptor': {'name': name}, 'state': value})

def execute_cdp_cmd(self, cmd: str, cmd_args: dict):
"""
Execute Chrome Devtools Protocol command and get returned result
Expand Down

0 comments on commit fc05f3a

Please sign in to comment.