minkphp / MinkSelenium2Driver

Selenium2 (webdriver) driver for Mink framework
MIT License
507 stars 163 forks source link

Selenium 4 support #373

Closed AlexSkrypnyk closed 8 months ago

AlexSkrypnyk commented 1 year ago

Selenium 2 was released 7 years ago.

Official Selenium docker images with inbuilt Chrome starting version 112 dropped support for non-W3C compliant API. This means that it is no longer possible to use this Selenium 2 driver as-is with newer versions of Selenium.

Non-W3C session creation example:

curl -X POST http://localhost:4444/wd/hub/session -d '{"desiredCapabilities":{"browserName":"chrome"}}' -H "Content-Type: application/json"

W3C session creation example:

curl -X POST http://localhost:4444/wd/hub/session -d '{"capabilities": {"firstMatch": [{"browserName": "chrome"}]}}' -H "Content-Type: application/json"

As one can see, there are no more desiredCapabilities and the config structure was changed.

If one uses friends-of-behat/mink-extension, version 2.7.3 added support to provide Selenium 4 driver support.

There is now a fork of this repo into Selenium 4 Driver - https://github.com/eDiasoft/MinkSelenium4Driver

Currently, there are many projects keep using the old Selenium 2 setup because it is not clear what the upgrade path looks like.

@stof Could you please summarise what the community should expect from this specific repository - will it be updating to support Selenium 4 (will the name stay?), or will the community need to look at alternatives (like the fork specified above)? Or such compatibility layer lies in another package, like instaclick/web-driver?

Thank you

p.s. Sorry to tag you like this and raising it here. It took me about half of day to get my head around all these dependencies, deprecations and inter-version configuration changes. There is not much information about all of this in one place. I was hoping you could share you knowledge about this here so that others would not have to search through many many places. Thanks again

stof commented 1 year ago

We have started the work on a new driver at https://github.com/minkphp/webdriver-classic-driver that will use a different webdriver library to have better support for the W3C webdriver protocol. the work is not done yet though (for now, most of the work is in a PR).

uuf6429 commented 8 months ago

I think this issue can be closed, now that the WIP PR has been merged.

AlexSkrypnyk commented 8 months ago

@uuf6429 Could you please provide more information about which exact "WIP PR" you are talking about.

uuf6429 commented 8 months ago

@AlexSkrypnyk when Christophe wrote that comment, I think he meant this PR: https://github.com/minkphp/webdriver-classic-driver/pull/1 It has been merged late last year, which means that that driver can actually be used (albeit in a pre-release stage).

Does this answer the question(s) from this issue?

AlexSkrypnyk commented 8 months ago

The ask in this ticket was to summarise the steps one needs to take to make the driver work with Selenium 4.

I still do not understand what the whole solutions looks like and would appreciate some extended information.

aik099 commented 8 months ago

@AlexSkrypnyk , this driver (https://github.com/minkphp/MinkSelenium2Driver) can't work with Selenium 4.

But the https://github.com/minkphp/webdriver-classic-driver driver can. I've added a sample PHP code in the https://github.com/minkphp/webdriver-classic-driver/pull/13.

AlexSkrypnyk commented 8 months ago

@aik099 Thank you I will move any further discussions into minkphp/webdriver-classic-driver.

aik099 commented 8 months ago

Discussion moved to https://github.com/minkphp/webdriver-classic-driver/pull/13#issuecomment-1963064913 .