minkphp / Mink

PHP web browser emulator abstraction
https://mink.behat.org/
MIT License
1.6k stars 280 forks source link

Add support for executeScript/evaluateScript args #826

Open mvorisek opened 2 years ago

mvorisek commented 2 years ago

The args support is necessary as webdriver objects must be passed natively to the underlaying drivers & cannot be serialized directly into the 1st script argument.

Example executeScript method prototype of one of the most popular driver - https://github.com/php-webdriver/php-webdriver/blob/8ffa927b270e932449e8015abf4d38bb0eff24b7/lib/Remote/RemoteWebDriver.php#L324

codecov[bot] commented 2 years ago

Codecov Report

Merging #826 (b37c535) into master (19e5890) will decrease coverage by 0.29%. The diff coverage is 75.00%.

@@             Coverage Diff              @@
##             master     #826      +/-   ##
============================================
- Coverage     98.47%   98.17%   -0.30%     
  Complexity      345      345              
============================================
  Files            23       24       +1     
  Lines           983      986       +3     
============================================
  Hits            968      968              
- Misses           15       18       +3     
Impacted Files Coverage Δ
src/Driver/DriverInterface.php 0.00% <0.00%> (ø)
src/Driver/CoreDriver.php 100.00% <100.00%> (ø)
src/Session.php 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 19e5890...b37c535. Read the comment docs.

aik099 commented 2 years ago

Adding more parameters to the DriverInterface interface might be a BC break (not sure if an optional argument causes BC breaks). I guess you'll need to create PR for every driver to pass through these arguments. I guess the Selenium2 is the only one capable of it.

mvorisek commented 2 years ago

Yes, it is fatal error BC break - https://3v4l.org/kO2hW.

I will create PRs to these drivers - https://github.com/minkphp/MinkSelenium2Driver and https://github.com/silverstripe/MinkFacebookWebDriver shortly. What are the other popular drivers?

stof commented 2 years ago

We simply cannot do such BC break in a minor version. That would mean we stop applying semver.

mvorisek commented 2 years ago

Are there any objections to release a v2?

stof commented 1 year ago

even for doing a v2, we would want to provide a migration path