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 setting browser commandline args via capabilities #89

Open
jan-imrich opened this issue Oct 7, 2024 · 1 comment
Open

Allow setting browser commandline args via capabilities #89

jan-imrich opened this issue Oct 7, 2024 · 1 comment

Comments

@jan-imrich
Copy link

When using this driver from behat, there is no way of setting the browser commandline args (ie. --headless or --start-maximized for chrome).

mink-selenium2-driver allows to specify chromeOptions under extra_capabilities (and similar with other browsers). It would be nice if it was compatible, so you could switch between mink-phpwebdriver-extension and mink-selenium2-driver.

I have tried to hardcode
$capabilities['goog:chromeOptions']['args'] = ['--start-maximized'];
into buildDriver() metod and it seems to work, so it should be a matter of just passing those arguments through.

Maybe there already is other way of doing this, but I couldn't figure it out.

@oleg-andreyev
Copy link
Owner

In order add "capabilities" you need to access webdriver:

        $desiredCapabilities = $this->getDesiredCapabilities();
        $chromeOptions = $desiredCapabilities->getCapability(\Facebook\WebDriver\Chrome\ChromeOptions::CAPABILITY);

or

        $desiredCapabilities = $this->getWebDriver()->getCapabilities();
        $chromeOptions = $desiredCapabilities->getCapability(\Facebook\WebDriver\Chrome\ChromeOptions::CAPABILITY);

if using Behat, I'd suggest trying https://github.com/oleg-andreyev/MinkPhpWebdriverExtension

but I haven't updated it, because I no longer use Behat myself.

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

2 participants