teodesian / Selenium-Remote-Driver

Perl Bindings to the Selenium Webdriver server
173 stars 91 forks source link

1.21 broke chromedriver support #364

Closed coolo closed 6 years ago

coolo commented 6 years ago

Hi,

Since we updated to 1.21 I get this in my tests using chromedriver:

Uncaught exception from user code: Error while executing command: Server returned error message unknown command: session/8372c046bd9cba3aa5ac71062c685836/window/rect instead of data at /suse/coolo/perl5/lib/perl5/Selenium/Remote/Driver.pm line 378. at /suse/coolo/perl5/lib/perl5/Selenium/Remote/Driver.pm line 344.

This is 100% reproducible and a git bisect lead me to 3f6169175521acde6130e80ac0431de96089185b. This happens both in my perl 5.26 work station as on the perl 5.18 travis builds we do. E.g. https://travis-ci.org/os-autoinst/openQA/jobs/333771338

teodesian commented 6 years ago

Steps to reproduce & chromedriver/chrome versions used would be appreciated. The error you are encountering suggests that you are using either get_window_size or get_window_position (or the two setters of those). Would that be the case? If so, I wasn't able to observe this on latest chromium/chromedriver -- at/sanity-chrome.test specifically checks for this.

Is it possible this is a chrome/chromedriver version issue? If so, that's still fine and I should figure out some way to build in even more shims for chromedriver.

teodesian commented 6 years ago

This likely means that chromedriver identifies itself the exact same way in pre-WD3 drivers as it does currently, which honestly isn't much of a shock now that I've been dealing with this. The fix would probably be to torture the driver until it confess()es that it isn't really WD3 capable at all.

If only API authors did something sane like provide a service catalog method. Then life would be easy.

teodesian commented 6 years ago

Try above patch, I've disabled using WD3 set/get window rect on chrome with a hammer, and it seems to work fine on latest chrome/chromedriver.

teodesian commented 6 years ago

Oh, you can always try the 'nuclear option' and just do $driver->{is_wd3} = 0 to force all interaction to be done by JSONWire methods.

coolo commented 6 years ago

this is stable chrome on travis and chromium 63 on my workstation - both show exactly the same error.

The patch worked for me, but I had to disable the tests to convince dist::zilla to install :)

And the code crashing isn't doing anything fancy:

From https://github.com/os-autoinst/openQA/blob/master/t/lib/OpenQA/SeleniumTest.pm

        $_driver = Test::Selenium::Chrome->new(%opts);
        $_driver->set_implicit_wait_timeout(2000);
        $_driver->set_window_size(600, 800);
        $_driver->get("http://localhost:$mojoport/");
teodesian commented 6 years ago

Cool, looks like I figured it out then. OK, I'll get the unit tests' attitude adjusted, and will submit a new version to CPAN tonight. Thanks for the report.