teodesian / Selenium-Remote-Driver

Perl Bindings to the Selenium Webdriver server
174 stars 90 forks source link

Edge fails unless S::R::RemoteConnection is hacked #385

Closed DrJHD closed 6 years ago

DrJHD commented 6 years ago

OS: Windows 10. Start MicrosoftWebDriver.exe and the following code fails:

use strict; use warnings;
use feature 'say';
use Selenium::Remote::Driver;

my $driver = Selenium::Remote::Driver->new(
    'port' => 17556,
);
$driver->get('http://www.perlmonks.org');
say $driver->get_title();
$driver->quit();

Hack Selenium::Remote::RemoteConnection to remove line 101 in both 1.26 and 1.27 versions and the code will run. This hack is very ugly & not recommended for production.

teodesian commented 6 years ago

Huh, last I checked Edge Driver worked. Guessing they updated something and now you gotta say different special magic words.

DrJHD commented 6 years ago

George S. Baugh - notifications@github.com wrote:

Huh, last I checked Edge Driver worked. Guessing they updated something and now you gotta say different special magic words.

Colour me unsurprised. I did quite a bit of hacking on this one and I'm pretty sure I'm using the latest versions of everything - barring changes in the last few days or hours. As I wrote in my book, I think this would be part of the work needed to get IE working. I couldn't make it work in any form.

Now that the book (https://www.amazon.com/dp/B07D5VQR98/) is out, I'll be putting up bug reports for all the issues I found. I've added a workaround to the thread about element finders croaking with a reference to the book & the code examples, which are available for free download. Obviously I'm trying to plug my book, but I'm not entirely shameless. I'm hoping that the bugs I have found and will report can lead to better software - and a second edition! :-)

Regards,

John Davies (DrJHD on github, davies on PerlMonks)

teodesian commented 6 years ago

101: . $self->wd_context_prefix

So no wd/hub anymore, eh? Guess I'll have to add another shim for that.

Looks like this may be due to using the driver directly rather than mediated by selenium-server.jar. I'll investigate making specific hacks for this much like is done in Selenium::Firefox (see the has +wd_context_prefix bit).

teodesian commented 6 years ago

As a special bonus gift, my acceptance test (at/sanity-edge.test) is now 'splodey on ->quit(). Huzzah.

teodesian commented 6 years ago

whee, get_all_cookies now explodes with latest edge driver. #Quality

teodesian commented 6 years ago

OK, so definitely can reproduce this, and I can say with confidence I should make a class to wrap direct use like this.

Until then, don't use drivers directly -- interpose using selenium-server-standalone.jar (download at seleniumhq, and invoke like so):

java -Dwebdriver.edgedriver=MicrosoftWebDriver.exe -jar selenium-server-standalone-3.12.0.jar

You can then connect without passing a port, as it will use the default of 4444.

teodesian commented 6 years ago

OK, I just added a new class, Selenium::Edge

Added example usage as at/edge.test

Lemme know if it works for you