teodesian / Selenium-Remote-Driver

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

Selenium::Remote::Driver doesnt work but Selenium::Firefox does #487

Open davewood opened 1 year ago

davewood commented 1 year ago

im using this module with firefox running inside this official container -> https://hub.docker.com/r/selenium/standalone-firefox

BEFORE

this used to work but doesnt anymore

use Selenium::Remote::Driver;
my $driver = Selenium::Remote::Driver->new(
    remote_server_addr => 'epplication-selenium',
    port => 4444,
);
$driver->get('http://www.metacpan.org');
print $driver->get_title();

AFTER

after updating the container im getting the following error message

Could not create new session: Server returned error message read timeout at /home/epplication/EPPlication/local/lib/perl5/Net/HTTP/Methods.pm line 274.
 instead of data at lib/sel.pl line 7.

However, if I use Selenium::Firefox instead of Selenium::Remote::Driver, like so

use Selenium::Firefox;
my $driver = Selenium::Firefox->new(
    remote_server_addr => 'epplication-selenium',
    port => 4444,
);
$driver->get('http://www.metacpan.org');
print $driver->get_title();

it works and prints this output on STDOUT

Search the CPAN - metacpan.org

I didnt find information what the difference is. and also no feedback from the code that gives insight.

teodesian commented 1 year ago

The docker container uses Selenium Grid Server 4.9.0.

Selenium 4 breaks the connection code and has for quite some time. I'm halfway thru making the necessary adjustments but had to put it down for the last few months.

Using firefox directly works, because geckodriver hasn't ripped out the Selenium 3 code yet. Nor has chromedriver.

Selenium::Client can and does work with S4, but as mentioned I haven't replaced the backend code with that yet; S::R::D has quite a bit of baggage. Namely that the new standard has no analogue for many Selenium 2 and 3 commands, and will need polyfills.

davewood commented 1 year ago

Thank you for clearing things up for me and also for the effort you've put into this module. Its one of the pieces of software that added alot of value to my own work.

Feel free to close this issue.

teodesian commented 9 months ago

Update on this -- I've released an early version of a S::R::D drop-in replacement as part of Selenium::Client -- Selenium::Client::Driver.

The plan going forward is to try and integrate this into S::R::D itself in the event we detect S4 servers.