minkphp / MinkSelenium2Driver

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

Iframe switch - Send element info as selenium 4 require it #361

Closed omarlopesino closed 8 months ago

omarlopesino commented 1 year ago

Problem

When I try to switch to an iframe with the switchToIframe method I receive the following error:

invalid argument: 'id' can not be string

Steps to reproduce

Call the method 'switchToIframe' method of the Selenium2DriverClass passing the 'id' of the iframe it is needed to switch to as a string:

  $driver->switchToIframe('iframe-id');

Proposed resolution

According to the current specs , it must be an object that contains the element ID inside. So, in the switchToIframe method, we must change the format to send the element ID (UUID) of the element we are switching to, instead of the plain id passed by arguments. When the name of the iframe passed is null, we must send nothing.

Currently, this solution makes the library not compatible with selenium 3, but as far as I understand selenium 4 is stable so it should be replaced.

aik099 commented 1 year ago

Currently, this solution makes the library not compatible with selenium 3, but as far as I understand selenium 4 is stable so it should be replaced.

Still a BC break.

aik099 commented 8 months ago

The frame switching support (works for both Selenium 2 and 3) was implemented in https://github.com/minkphp/MinkSelenium2Driver/pull/382.

For Selenium 4 support use the https://github.com/minkphp/webdriver-classic-driver driver.

Thank you, @mvorisek .