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

Allow executing of custom webdriver commands #605

Closed
matej-pavla opened this issue Oct 15, 2018 · 2 comments
Closed

Allow executing of custom webdriver commands #605

matej-pavla opened this issue Oct 15, 2018 · 2 comments

Comments

@matej-pavla
Copy link

matej-pavla commented Oct 15, 2018

What are you trying to achieve? (Expected behavior)

To execute chromedriver's Page.setDownloadBehavior to allow downloading of files when using chrome in --headless mode. More generally to allow executing of custom webdriver commands.

More about the chromedriver issue here: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2454 Basically, to be able to download files in headless chrome, one needs to execute command to url /session/:sessionId/chromium/send_command with following params:

$params = array(
        'cmd' => 'Page.setDownloadBehavior',
        'params' => array(
                "behavior" => 'allow',
                "downloadPath" => DOWNLOADS_PATH,
        ),
);

Using existing webdriver's functionality it's not possible, since HttpCommandExecutor's execute which seem to contain the logic for sending the request only works with the pre-defined commands from the $commands array and /session/:sessionId/chromium/send_command is just not one of them.

To solve this problem it would be nice to add some method or a way to easily extend HttpCommandExecutor to handle custom commands and then be able to use it with RemoteWebDriver.

What do you get instead? (Actual behavior)

I am not able to currently execute such command via php-webdriver.

Details

  • Php-webdriver version: 1.6
  • PHP version: 7.1
  • Selenium server version: 3.14
  • Operating system: Mac
  • Browser used + version: Chrome
@era404design
Copy link

Sorry, was there a resolution for this? I haven't been able to perform a successful download headlessly, whereas all downloads performed non-headlessly are successful. Thanks in advance.

@OndraM
Copy link
Collaborator

OndraM commented Feb 7, 2020

Custom commands were merged in #738 and will be part of 1.8.0 - so it may already by possible to achieve this via custom command.
Furthermore there is also PR #556 for DevTools commands which will make this even more convenient in future.

@OndraM OndraM closed this as completed Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants