Skip to content

Support the W3C webdriver spec #293

Closed

Description

@stof

Support for the JsonWire selenium protocol is fading out in favor of the W3C spec:

We will have some work to do to make this happen.

The instaclick/php-webdriver library that we are using has a beta version of 2.0 which adds support for interacting with a W3C server. But they won't provide an abstraction layer to make the same code work for both variants (see instaclick/php-webdriver#84). It will be up to our code to choose the right way (and we will need instaclick/php-webdriver#86 to be able to know which one we need).
Due to the fact that we expose the webdriver session to userland, we would have to consider this upgrade as a BC break.

Another option could be to migrate to facebook/webdriver, which seems a bit more popular this days (https://packagist.org/?query=webdriver). It is currently adding support for the W3C spec (WIP is at php-webdriver/php-webdriver#560), and does so by abstracting the differences internally).
Doing such migration would also require making it a major release, as we would change the API we expose when exposing the session.

Activity

  1. stof commented on Sep 24, 2018

    @stof
    MemberAuthor

    #288 was created to refer to the first solution for this topic (but does not describe the implication, and does not seem to care about the W3C support in the PR implementing it)

  2. stof commented on Sep 24, 2018

    @stof
    MemberAuthor

    #287 should be done first before this work (we should switch to Chrome on Travis, as there is no way to run recent Firefox versions with the JsonWire protocol).

  3. stof commented on Oct 3, 2018

    @stof
    MemberAuthor

    The more I look at instaclick/php-webdriver 2 "supporting" the WEC protocol (currently in RC), the more I think we should rather migrate to the facebook package (for which the PR supporting the W3C protocol inside their abstraction is almost ready AFAICT).

  4. stof commented on Oct 3, 2018

    @stof
    MemberAuthor

    Btw, if we look at https://packagist.org/packages/instaclick/php-webdriver/dependents and the download counts on https://packagist.org/?query=webdriver, I think most of the downloads of instaclick/php-webdriver are coming from Mink using it (our driver has 11 176 049 downloads, the library has 11 517 849, so this only means 340k downloads not coming from us, which is 3%).
    Among the 12 packages depending on instaclick/php-webdriver on Packagist, here is my analysis:

    • 1 is us
    • 2 are (abandoned) forks of us, (one direct fork, and a ghost-driver which duplicated our codebase instead of depending on us)
    • 3 are about locking exact versions of deps in the Drupal ecosystem and so are related to us (as Drupal is using Mink)
    • 1 is an abandoned experiment from the Laravel ecosystem, but laravel/dusk has been based on the facebook library instead.
    • 1 is a fork of the previous experiment
    • the remaining 4 look abandoned (last commits either in 2016 or 2014)

    So we are the only ones keeping instaclick/php-webdriver alive in the open.

  5. aik099 commented on Oct 3, 2018

    @aik099
    Member

    #293 (comment)

    Unfortunately Facebook Web Driver is now requiring PHP 7 and that was main reason why PR still isn't merged.

  6. stof commented on Oct 4, 2018

    @stof
    MemberAuthor

    @aik099 as we need to make a new major release of the driver anyway, I'm fine with requiring PHP 7.1+ for it. All older PHP versions will be EOLed by the end of December.

    People really wanting to use PHP 5.x could still use Selenium2Driver 1.x and use Chrome (or another browser with a driver supporting the legacy protocol)

  7. aik099 commented on Oct 4, 2018

    @aik099
    Member

    Agreed. We'll then have new driver require PHP 7.1, but Mink itself stays with current 5.x requirement.

  8. stof commented on Oct 4, 2018

    @stof
    MemberAuthor

    Well, Mink itself will probably bump its own requirement in the future too, but I don't have a roadmap for that (as long as we don't make changes benefiting from it, there is no strong need)

  9. nirbhaypatil commented on Oct 9, 2018

    @nirbhaypatil

    just wanted to know how to use instaclick/php-webdriver:2.0.0-RC2 with mink and mink extension ?
    dependencies mismatch error comes up.

    {
    "require": {
    "behat/behat":"~3",
    "behat/mink": "1.7.1",
    "behat/mink-extension": "2.2",
    "behat/mink-selenium2-driver": "1.3.1",
    "behat/mink-goutte-driver": "1.2.1",
    "drupal/drupal-extension":"3.1.5",
    "sensiolabs/behat-page-object-extension": "dev-master"
    },
    "config": {
    "bin-dir": "bin/"
    }
    }

    Your requirements could not be resolved to an installable set of packages.

  10. stof commented on Oct 9, 2018

    @stof
    MemberAuthor

    currently, you cannot do it directly.

  11. nirbhaypatil commented on Oct 10, 2018

    @nirbhaypatil

    even with facebook/webdriver + minkextension?
    can you suggest other ways to do .

  12. stof commented on Oct 10, 2018

    @stof
    MemberAuthor

    I don't understand your question. You asked whether you can use instaclick/php-webdriver:2.0.0-RC2, and now you say even with facebook/webdriver ?. I don't see how they are related.

  13. nirbhaypatil commented on Oct 10, 2018

    @nirbhaypatil

    Sorry about confusion ,my question is
    Can we use

    1. mink + minkextension + instaclick/php-webdriver:2.0.0-RC2
      OR
    2. mink + minkextension + facebook/webdriver
      to execute tests on firefox > 48
  14. stof commented on Oct 10, 2018

    @stof
    MemberAuthor

    none of that is possible today, which is precisely what this issue is about:

    So we are still discussing in which direction we want to rewrite the driver (supporting the W3C spec on top of instaclick/php-webdriver:2 also involves lots of rewriting in the driver).

  15. oleg-andreyev commented on Dec 2, 2018

    @oleg-andreyev
    Contributor

    @stof recently we've been trying to migrate this library to facebook/php-webdriver, mostly because of syn.js which bundled into this library and because instaclick/php-webdriver is not supported that actively.

    So far my results:
    Diff: master...oleg-andreyev:master
    Travis Build (with Chrome): https://travis-ci.org/oleg-andreyev/MinkSelenium2Driver/jobs/462514905
    Travis Build (with FF): https://travis-ci.org/oleg-andreyev/MinkSelenium2Driver/jobs/462514904
    Travis: https://travis-ci.org/oleg-andreyev/MinkSelenium2Driver/builds/462514900

    There are few issues with Chrome eg: Keyboard event, but it it's related to assert of driver-testsuite.
    Also there are issues with facebook/webdriver and with FF

  16. 13 remaining items

  17. jimarasim commented on Jul 24, 2019

    @jimarasim

    When setting w3c to false, use "goog:chromeOptions" instead of "chromeOptions"
    extra_capabilities:
    "goog:chromeOptions":
    w3c:
    false

    Hoping this issue is resolved before Chrome decides to no longer support jsonwire at all.

  18. emodric commented on Jul 31, 2019

    @emodric

    Is it only me, or this started to work on its own in latest versions of Chrome Driver 75 and even in the new v76?

  19. phil-davis commented on Aug 1, 2019

    @phil-davis

    I am using selenium/standalone-chrome-debug in drone-docker. latest of that still fails, and I have to specify 3.141.59-oxygen

  20. shwetaneelsharma commented on Aug 8, 2019

    @shwetaneelsharma

    @alexdesignworks Thanks a ton for this solution #293 (comment)
    However, does it work for headless execution too? I am only able to get it working for browser-based execution

  21. shwetaneelsharma commented on Aug 9, 2019

    @shwetaneelsharma

    I have got this working on Chrome 75 in headless mode by using the following configuration:
    `

    Behat\MinkExtension:  
        base_url: "your_base_url"  
        browser_name: 'chrome'
        goutte: ~
        javascript_session: selenium2
        selenium2:
          wd_host: http://127.0.0.1:4444/wd/hub
          capabilities:
            browser: chrome
            extra_capabilities:
              chromeOptions:
                args: ['--headless', '--disable-gpu']
                w3c: false`
    
  22. jimarasim commented on Aug 10, 2019

    @jimarasim

    With Chrome 76.0.3809.100 / Chromedriver Version = 76.0.3809.68 '--headless' only works for me if "chromeOptions:" is "goog:chromeOptions"; otherwise, it still runs headed.

  23. marcusanderss commented on Dec 10, 2019

    @marcusanderss

    The problem is possible 'fix' it by inserting the following 3 lines at the start of the webDriverElement function in Behat, vendor/instaclick/php-webdriver/lib/WebDriver/Container.php:
    protected function webDriverElement($value)
    {
    if (!array_key_exists('ELEMENT', $value)) {
    $value['ELEMENT'] = $value['element-6066-11e4-a52e-4f735466cecf'];
    }

  24. robbieaverill commented on Dec 14, 2019

    @robbieaverill

    Hi everyone, facebook/php-webdriver support for the W3C protocol is nearly ready: php-webdriver/php-webdriver#560 (comment). Would be worth testing an update to use it now? I'm happy to assemble a PR from @tractorcow's fork (to use facebook/php-webdriver) if it would help as well.

  25. added a commit that references this issue on Jan 14, 2020
  26. AntoscencoVladimir commented on Jul 4, 2020

    @AntoscencoVladimir

    When setting w3c to false, use "goog:chromeOptions" instead of "chromeOptions"
    extra_capabilities:
    "goog:chromeOptions":
    w3c:
    false

    Hoping this issue is resolved before Chrome decides to no longer support jsonwire at all.

    Thank you!

  27. Scobee commented on Oct 26, 2021

    @Scobee

    @stof can you please tell me if latest version of Edge & Firefox are supported with Mink selenium2driver, using selenium 4 ?

  28. stof commented on Aug 6, 2024

    @stof
    MemberAuthor

    Closing this as we have created the mink/webdriver-classic-driver package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions