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

Add support for sending Chrome DevTools commands #556

Closed
wants to merge 2 commits into from

Conversation

aboks
Copy link
Contributor

@aboks aboks commented Mar 27, 2018

ChromeDriver has two endpoints for calling the DevTools API. This PR adds support for calling these endpoints (sending DevTools commands) using php-webdriver.

@aboks
Copy link
Contributor Author

aboks commented Mar 4, 2020

@OndraM is there anything I could do to help move this PR forward?

@williamdes williamdes requested a review from OndraM March 4, 2020 11:01
@OndraM OndraM changed the base branch from master to main June 23, 2020 10:04
@OndraM OndraM added enhancement New feature and removed CLA Signed labels Oct 6, 2020
@OndraM
Copy link
Collaborator

OndraM commented Nov 19, 2020

After a further consideration, I think this may need a different approach. Lets wait with finishing it after 1.9.0.

However executing ChromeDevTools protocol is possible since php-webdriver 1.8.0 via custom commands:

Send command:

$driver->executeCustomCommand(
    '/session/:sessionId/goog/cdp/execute', 
    'POST',
    ['cmd' => 'Performance.enable']
);

Send command and receive result:

$metrics = $driver->executeCustomCommand(
    '/session/:sessionId/goog/cdp/execute',
    'POST',
    ['cmd' => 'Performance.getMetrics']
);

Send command with parameters and receive result:

$return = $driver->executeCustomCommand(
    '/session/:sessionId/goog/cdp/execute',
    'POST',
    ['cmd' => 'Runtime.evaluate', 'params' => ['expression' => 'window.location.toString()']]
);

@OndraM OndraM marked this pull request as draft November 19, 2020 15:24
@OndraM
Copy link
Collaborator

OndraM commented Nov 19, 2020

Also the endpoint URL was meanwhile changed in chromium to /session/:sessionId/goog/cdp/execute

https://bugs.chromium.org/p/chromedriver/issues/detail?id=2307

@OndraM
Copy link
Collaborator

OndraM commented Nov 20, 2020

Replaced by #832 . Thanks @aboks for this initial implementation!

@OndraM OndraM closed this Nov 20, 2020
@OndraM
Copy link
Collaborator

OndraM commented Nov 25, 2020

✔️ This feature is now merged and documented in our wiki with examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants