1

I've got a problem running Selenium with Perl's Selenium::Remote::Driver.

I'm on Ubuntu 22 with Selenium standalone 3.9.1 + Geckodriver 0.29.0 + Firefox 91.7.0esr

First, I've tried to use the newest versions of all software but there was error too. On the other machine with Centos 7 on it I've got all this software working fine, so I've decided to downgrade everything to the older versions.

I've installed Firefox from sources, downloaded the Selenium 3.9.1 just from my Centos 7 machine (to be sure it's fine) and downloaded the Geckodriver.

I run Selenium server with this command (the geckodriver is in the same folder):

xvfb-run java  -Dwebdriver.gecko.driver=./geckodriver -jar selenium-server-standalone-3.9.1.jar

The server starts normally, but when I try to run my Perl script - it starts and "freezes" at the string where I create a new Selenium::Remote::Driver object.

This is what Selenium writes:

xvfb-run java  -Dwebdriver.gecko.driver=./geckodriver -jar selenium-server-standalone-3.9.1.jar

21:01:29.989 INFO - Selenium build info: version: '3.9.1', revision: '63f7b50'
21:01:29.990 INFO - Launching a standalone Selenium Server on port 4444
2022-12-10 21:01:30.614:INFO::main: Logging initialized @1317ms to org.seleniumhq.jetty9.util.log.StdErrLog
2022-12-10 21:01:30.916:INFO:osjs.Server:main: jetty-9.4.7.v20170914, build timestamp: 2017-11-21T21:27:37Z, git hash: 82b8fb23f757335bb3329d540ce37a2a2615f0a8
2022-12-10 21:01:30.967:WARN:osjs.SecurityHandler:main: ServletContext@o.s.j.s.ServletContextHandler@76508ed1{/,null,STARTING} has uncovered http methods for path: /
2022-12-10 21:01:30.974:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@76508ed1{/,null,AVAILABLE}
2022-12-10 21:01:31.050:INFO:osjs.AbstractConnector:main: Started ServerConnector@94c87b{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2022-12-10 21:01:31.051:INFO:osjs.Server:main: Started @1754ms
21:01:31.051 INFO - Selenium Server is up and running on port 4444
2022-12-10 21:01:43.601:INFO:osjshC.ROOT:qtp770189387-11: org.openqa.selenium.remote.server.WebDriverServlet-7f1302d6: Initialising WebDriverServlet
21:01:43.741 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.Status@18d81100
21:01:43.750 INFO - /status: Executing GET on /status (handler: Status)
21:01:43.779 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@7dd86e24
21:01:43.789 INFO - /session: Executing POST on /session (handler: BeginSession)
21:01:43.899 INFO - Capabilities are: Capabilities {acceptSslCerts: true, browserName: firefox, javascriptEnabled: true, version: }
21:01:43.900 INFO - Capabilities {acceptSslCerts: true, browserName: firefox, javascriptEnabled: true, version: } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
1670706103980   geckodriver     INFO    Listening on 127.0.0.1:16612
1670706104621   mozrunner::runner       INFO    Running command: "/usr/bin/firefox" "--marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileRTGbtt"
[GFX1-]: glxtest: libEGL missing
1670706106386   Marionette      INFO    Marionette enabled
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/rust_mozprofileRTGbtt/search.json.mozlz4", (void 0)))
1670706150816   Marionette      INFO    Listening on port 36747
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
21:02:45.425 INFO - HTTP Status: '500' -> incorrect JSON status mapping for 'timeout' (408 expected)

Update: The part of my Perl script, it freezes at the string "my $driver = Selenium::Remote::Driver->new;"

#!/usr/bin/perl

use strict;
use warnings;

use utf8;

use DBI;
use Selenium::Remote::Driver;
use Data::Dumper;

binmode STDOUT, ":utf8";

print "Started parser at ".scalar(localtime)."\n\n";

my $dbh = DBI->connect("DBI:mysql:db", "user", "pass", {mysql_enable_utf8 => 1});

my $total_words = 0;

exit if !$ARGV[0];

my @dictionary = @ARGV;

print "Initial hashtag(s): ".join(" ", @dictionary)."\n\n";

my $driver = Selenium::Remote::Driver->new;

$driver->set_window_position(0, 0);
$driver->set_window_size(20000, 600, 'current');

......

Update 2: I've installed the Firefox 108 from source, downloaded geckodriver 0.32.0 and selenium 4.7.1 as @HåkonHægland have suggested. But still it's not working.

Here are the outputs: This is the output when I try to run the Perl script:

Could not create new session: Server returned error message read timeout at /usr/share/perl5/Net/HTTP/Methods.pm line 274.

This is the output of Selenium-server when I try to run the script:

17:36:55.676 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "8206aa152f3c4da7260f4378969b94f1","eventTime": 1670953004537922002,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:13123","exception.message": "Error while creating session with the driver service. Stopping driver service: java.util.concurrent.TimeoutException\nBuild info: version: '4.7.1', revision: 'c6795baf1a3'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1026-aws', java.version: '11.0.17'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.TimeoutException: java.util.concurrent.TimeoutException\nBuild info: version: '4.7.1', revision: 'c6795baf1a3'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1026-aws', java.version: '11.0.17'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:65)\n\tat org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)\n\tat org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)\n\tat org.openqa.selenium.remote.http.netty.NettyHttpHandler.execute(NettyHttpHandler.java:49)\n\tat org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)\n\tat org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:56)\n\tat org.openqa.selenium.remote.http.netty.NettyClient.execute(NettyClient.java:99)\n\tat org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:55)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:124)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:106)\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:146)\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:69)\n\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:147)\n\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:379)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:645)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:564)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:818)\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:779)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base\u002fjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base\u002fjava.lang.Thread.run(Thread.java:829)\nCaused by: java.util.concurrent.TimeoutException\n\tat java.base\u002fjava.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1886)\n\tat java.base\u002fjava.util.concurrent.CompletableFuture.get(CompletableFuture.java:2021)\n\tat org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:206)\n\tat org.openqa.selenium.remote.http.netty.NettyHttpHandler.makeCall(NettyHttpHandler.java:59)\n\t... 21 more\n","exception.type": "org.openqa.selenium.TimeoutException","logger": "org.openqa.selenium.grid.node.config.DriverServiceSessionFactory","session.capabilities": "{\"acceptSslCerts\": true,\"browserName\": \"firefox\",\"javascriptEnabled\": true,\"platformName\": \"ANY\",\"version\": \"\",\"platform\": \"ANY\"}\n"}}
tester3
  • 413
  • 1
  • 4
  • 12
  • *"... when I try to run my Perl script - it starts and "freezes""* How do you run the perl script? Can you show a minimal example of the script? See [mcve] for more information – Håkon Hægland Dec 10 '22 at 23:30
  • @HåkonHægland I've updated the question with the part of code, but there is nothing special there really – tester3 Dec 11 '22 at 09:39
  • @HåkonHægland what does this string mean "[GFX1-]: glxtest: libEGL missing"? Isn't it a fatal error? – tester3 Dec 11 '22 at 10:28
  • Does the script work without using xvfb-run ? – Håkon Hægland Dec 11 '22 at 18:24
  • I tested this locally on my machine (Ubuntu 22.04) now, and I got a similar issue that you reported. But I think the problem here was that firefox was installed via snap, see https://stackoverflow.com/q/72405117/2173773. After installing a second firefox from source https://www.mozilla.org/en-US/firefox/linux/?utm_medium=referral&utm_source=support.mozilla.org the script seems to work fine now. – Håkon Hægland Dec 11 '22 at 19:29
  • @HåkonHægland no, I've already wrote that I've installed it from sources. I've tried to install it with snap too, and got this problem too. – tester3 Dec 11 '22 at 19:47
  • @HåkonHægland But I've installed the old version from the sources. Have you installed the old version or the new one? – tester3 Dec 11 '22 at 19:50
  • *" I've already wrote that I've installed it from sources"* Ok, I missed that. Here is what I have: Ubuntu 22.04, installed firefox 107.0.1 from source, downloaded geckodriver 0.32.0, selenium-server 4.7.0, and perl version 5.34.1 – Håkon Hægland Dec 11 '22 at 19:59
  • 1
    @HåkonHægland Ok, thanks a lot anyway, I'll check it and drop you a comment again a bit later! – tester3 Dec 11 '22 at 20:00
  • @HåkonHægland I've installed the Firefox 108 from source, downloaded geckodriver 0.32.0 and selenium 4.7.1 as you've suggested. But still it's not working. I've updated the question with the Selenium's output when I try to run the script. Maybe I'm doing something wrong? Or there is a kind of file permissions problem? Could you show the lines how do you run the Selenium-server and the Perl script? – tester3 Dec 13 '22 at 17:39
  • [Here](https://pastebin.com/PqnSxUJj) is how I run the selenium server and its output, and [here](https://pastebin.com/MftA4Fg3) is the perl script and its output – Håkon Hægland Dec 13 '22 at 20:21
  • 1
    @HåkonHægland You'll be laughing, but the solution was very unexpected - I've been using AWS EC2 and after I've increased CPU and RAM - everything started working correctely! Thanks a lot for your time and help! – tester3 Dec 13 '22 at 21:49

1 Answers1

1

The solution was very unexpected for me - I've been using AWS EC2 and after I've increased CPU and RAM - everything started working correctly!

tester3
  • 413
  • 1
  • 4
  • 12