Php-webdriver: sendKeys on RemoteWebElement no longer accepts an array

Created on 11 Feb 2020  路  7Comments  路  Source: php-webdriver/php-webdriver

What are you trying to achieve? (Expected behavior)

I'm one of the maintainers of Dusk and we got this issue report just in: https://github.com/laravel/dusk/issues/732 after people started updating to the new 1.8.0 version of php-webdriver. It seems that the changes in https://github.com/php-webdriver/php-webdriver/pull/560 are causing some problems and changing the behavior of some methods.

For example, we were sending an array of keys to the sendKeys but it doesn't accept that anymore when $this->isW3cCompliant is set to true in RemoteWebElement.

From what I can tell this is set to true automatically based on the driver. The changelog for 1.8.0 notes:

The protocol will be used automatically when remote end (like Geckodriver, newer Chromedriver etc.) supports it.

This seems unwanted because it changes the behavior (as noted above) on a minor release and thus causes breakages in upstream implementations (like Dusk).

I'd suggest the automatic enabling of the protocol is reverted and only applied when a new major version is released.

That or the breaking change in this particular case is fixed when the isW3cCompliant is enabled. But that would be more work I guess and I don't know where there could be more breaking changes.

What do you get instead? (Actual behavior)

Instead of allowing us to pass in an array like before we now get an array to string conversion exception.

How could the issue be reproduced? (Steps to reproduce)

I don't know the exact code to reproduce with only the php-webdriver but I guess that if you just use the chromedriver and were attempting to pass in an array to sendKeys on a RemoteWebElement instance before it'll now be broken. There's steps to reproduce the issue with dusk on this issue report: https://github.com/laravel/dusk/issues/732

Details

  • Php-webdriver version: 1.8.0
  • PHP version: 7.4.2
  • Selenium server version: unknown
  • Operating system: unknown
  • Browser used + version: unknown

I don't know about the last three versions above. I'll try to ask the person reporting the issue.

bug

Most helpful comment

Version 1.8.1 has just been released :rocket:

All 7 comments

Hi,
thanks for the report. I think two things are being mixed here. One is change in behavior because of W3C protocol, the other one is API change in php-webdriver.

The first one is unavoidable, Chrome is switching to W3C protocol and default use of the protocol in Chrome was done by Chrome team already in Chrome 75. There is a way how to explicitly disable the protocol if something goes wrong, however, the old protocol will be once removed in Chrome and it is also no longer maintained. And Firefox in last years never supported the old protocol, so to use Firefox, you must anyway use the new protocol.

However the fact that sendKeys() now works only with string seems like an API change of our method and thus BC break which could and should be fixed.

@OndraM thanks for clearing that up! :)

@driesvints The fix is prepared in #759, could you give it a try it?

BTW - I suggest chaning the method in Dusk to output string, not array. The conversion seems now redundant when in W3C mode (which sole will be supported in future) - you convert string to array of chars only to let php-webdriver convert it back to string, which is then submitted to the remote server.

  • Selenium server version: unknown
  • Operating system: unknown
  • Browser used + version: unknown

I don't know about the last three versions above. I'll try to ask the person reporting the issue.

Since I reported the original issue to laravel/dusk, then I'll comment:

  • Selenium server version: none
  • Operating system: MacOS 10.15.3
  • Browser used + version: Chrome 80.0.3987.87

@ahtinurme As I'm a bit strapped in time can you maybe try out the fix from @OndraM above? Thanks for the quick reply @OndraM 馃憤

The fix has been merged to master branch and will be part of 1.8.1.

Thanks everyone for the provided information!

Version 1.8.1 has just been released :rocket:

Was this page helpful?
0 / 5 - 0 ratings