Skip to content

[🚀 Feature]: Expose Chromium commands API in Remote #14799

@p0deje

Description

@p0deje

Feature and motivation

Currently there is a number of custom methods that expose Chromium commands in Chromium driver:

from selenium.webdriver import Chrome

driver = Chrome()
driver.execute_cdp_cmd('Page.enable')                                     # <-- custom method that calls command below
driver.execute("executeCdpCommand", {"cmd": "Page.enable', "params": {}}) # <-- custom command execution

The same commands should be accessible via Remote driver as well since Grid provides the endpoints and the underlying command executor actually already supports the commands:

from selenium.webdriver.chrome.options import Options
from selenium.webdriver import Remote

driver = Remote(options=Options())
driver.execute_cdp_cmd('Page.enable')                                     # <-- this method is not available
driver.execute("executeCdpCommand", {"cmd": "Page.enable', "params": {}}) # <-- this still works!

The same approach is implemented in other bindings (Java, Ruby), where instances of Remote driver are augmented to support custom methods and commands specific to browsers.

Usage example

See above for usage example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-pyPython BindingsI-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions