Skip to content

Condition prevents setting default capabilities #46

@uuf6429

Description

@uuf6429

if ($caps->getCapability($key) === null) {

☝️ That condition means that we cannot overwrite capabilities by the php-webdriver - in case of Firefox, because of this:
https://github.com/php-webdriver/php-webdriver/blob/4c18b78d93e4a724ad2dd6427ed658e61a45c569/lib/Remote/DesiredCapabilities.php#L299

For example, the following firefox capability change would not work:

    public const DEFAULT_CAPABILITIES = [
        'default' => [
            'platform' => 'ANY',
            'name' => 'Behat Test',
            'deviceOrientation' => 'landscape',
            'deviceType' => 'desktop',
        ],

        WebDriverBrowserType::FIREFOX => [  // <<<<<<<
            'moz:firefoxOptions' => [
                'args' => [
                    'some-argument',
                ],
            ],
        ],
    ];

(that also applies to the default one; we're not able to overwrite anything predefined in the php-webdriver defaults)

I think this code was copied from MinkSelenium2Driver, so I never really thought about it.

On a related note, I'm unsure how in general we are supposed to behave - should we be merging config, or generally overwriting it? That applies to php-webdriver defaults, our defaults and the end user's desired capaibilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions