http://www.perlmonks.org?node_id=1225398

Perlchaoui has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks !

I am requesting for your widsom guys. I am a beginner in Perl . This is the first time i use Perl language. I have to do some automation regarding some tests cases and i decided to use Perl because i had good feedback of using Perl in test automation. I am working with Selenium and i decided to use Selenium::Remote::Driver I think i did all the configurations as requested but i am facing an issue wen i want to run a simple script using this module.

Here is the code
#!/usr/bin/perl use strict; use warnings; #use Selenium::Firefox; use Selenium::Remote::Driver; my $driver = Selenium::Remote::Driver->new; $driver->get('http://www.google.com'); use Selenium::Remote::Driver;
and below the output when i launch my script from CMD:
C:\Users\user1\Documents\TESTPERL>perl TEST1.pl Could not create new session: Unable to create new service: GeckoDrive +rService Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02 +T20:13:22.693Z' System info: host: 'LBNL13608', ip: '10.132.5.117', os.name: 'Windows +7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_191' Driver info: driver.version: unknown at TEST1.pl line 8.

I don't understand why i have to use a "geckoDriver"?!

Thanks in advance,

Br

Replies are listed 'Best First'.
Re: Simple code using Selenium::Remote::Driver
by davies (Prior) on Nov 08, 2018 at 11:23 UTC

    Oversimplification: Firefox has an interface that is unlike other browsers. Geckodriver is the tool that converts commands and data between the format Firefox understands and the format Selenium understands. So yes, you need it. And note that the same applies to some other browsers like Edge, although obviously a different driver is needed.

    Regards,

    John Davies

      Many thanks John

      Ok i understand but i don't want to work with Firefox but I.E. As you can see i didn't call any instance of Firefox in my code.

      Do i need to install a webdriver for Firefox or I.E ? I'm really lost because i though i just have to use module Selenium::Remote::Driver.

      I am sorry to disturb with this issue but the informations regarding how to configure Selenium with Perl webdriver are really rares

Re: Simple code using Selenium::Remote::Driver
by bliako (Monsignor) on Nov 08, 2018 at 16:38 UTC
    Driver info: driver.version: unknown at TEST.pl line 9.

    Is the webdriver found at all? It looks like it is not. Or if it is found on disk, then some binary incompatibility may stop it from reading in even its version.

    In this link : https://github.com/SeleniumHQ/selenium/issues/5876 there is a one-liner to launch selenium and chrome via java. Try it but most likely it fails too.

      Thanks Bliako

      Exactly. The issue was coming from the webdriver itself

      I had to use chromedriver in conjunction with Selenium server, with the following command:

      java -Dwebdriver.chrome.driver=path -jar selenium-server-standalone-2. +33.0.jar

      That's why my code wasn't running

      Again, thank you for the support

Re: Simple code using Selenium::Remote::Driver
by LanX (Saint) on Nov 08, 2018 at 10:46 UTC
    I noticed that you are using the module twice in your code

    use Selenium::Remote::Driver;

    not sure if it's related to your problem.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      Thanks @LanX

      It is just a duplicate; when i did a copy/paste. I change that in the query

      But this is not the issue . Can someone bring a clarification on this concern please?