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

Selenium 4 removing support for DesiredCapabilities #1033

Open
andrewnicols opened this issue Oct 31, 2022 · 3 comments
Open

Selenium 4 removing support for DesiredCapabilities #1033

andrewnicols opened this issue Oct 31, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@andrewnicols
Copy link
Member

Bug description

As noted here, Selenium 4 will soon be removing support for the JsonWire prototocol. This will include removal of support for the DesiredCapabiliies which (I believe/recall) this driver currently includes for optimal compatibility with a wide range of drivers.

How could the issue be reproduced

It can't yet, but we should consider how to handle this now.

Expected behavior

We should probably drop support for the JsonWire protocol entirely in the long run, but perhaps we can get there by explicitly requesting a JsonWire connection for now when one is needed.

Php-webdriver version

main

PHP version

any

How do you start the browser driver or Selenium server

Selenium

Selenium server / Selenium Docker image version

Future

Browser driver (chromedriver/geckodriver...) version

n/a

Browser name and version

n/a

Operating system

n/a

Additional context

I came across this blog post from SeleniumHQ discussing their plans to drop JsonWire support entirely: https://www.selenium.dev/blog/2022/legacy-protocol-support/
In the issue discussing this removal, a developer has specifically asked if the intent is to deprecate DesiredCapabilities, and @titusfortner has confirmed that this is the intent: SeleniumHQ/selenium#10374 (comment)

@andrewnicols andrewnicols added the bug Something isn't working label Oct 31, 2022
@andrewnicols
Copy link
Member Author

If I recall, this is the section which we'll have to adjust: https://github.com/php-webdriver/php-webdriver/blob/main/lib/Remote/RemoteWebDriver.php#L111-L130 specifically:

        $parameters['desiredCapabilities'] = (object) $desired_capabilities->toArray();

@shihchenman
Copy link

shihchenman commented Nov 10, 2022

Docker chrome 107 does not work with json wire protocol anymore. We use json wire protocl in all our tests. After docker-selenium newest release last week, even with older selenium server (4.5.3 or 3.0.0) specified in the grid via docker-compose-v3.yml, all our tests failed, mostly with "Facebook\WebDriver\Exception\UnknownErrorException : non-positive contentLength: 0". The test would pass if the docker chrome node is 106 and earlier. Right now I am not able to run tests on docker chrome 107 on selenium grid or selenium standalone configuration. I can, however, run test on local 107 chrome driver, just not from the docker chrome container.
The error falls at HttpCommandExecutor where I can see the comment says it's supposed to be an error for W3C's WebDriver, not for our w3c=false driver.

// @see https://w3c.github.io/webdriver/webdriver-spec.html#handling-errors
if (isset($value['error'])) {
// W3C's WebDriver
WebDriverException::throwException($value['error'], $message, $results);
}

@OndraM
Copy link
Collaborator

OndraM commented Nov 15, 2022

Removal of JsonWire protocol should be part of php-webdriver 2.0, see #657 .

Desired capabilities (in terms of W3C protocol) are however not removed - https://w3c.github.io/webdriver/#capabilities

They are and always have been part of session initialization (we use the legacy term "desired capabilities" though). What Java WebDriver bindings are doing, is removing the "DesiredCapabilities" class, as they provide a different way how to setup the session (via browserOptions classes). However, internally, this is still converted to the same "capabilities" key in the W3C protocol.

So from protocol point of view, there is nothing forcing us to change this, as we already use "capabilities" key for W3C-compatible session setup and nothing will stop working when using W3C protocol.

A different thing is, however, if we don't want to change the session initialization to be similar to the java-one or to refactor it to some more user-friendly and more modern PHP-way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants