How to install Selenium::Remote::Driver in Ubuntu? - perl

I am trying to write a small code but as soon as i am importing "Selenium::Remote::Driver:", i get an error stating
"Can't locate Selenium/Remote/Driver.pm in #INC"
I have tried installing it using below command
sudo apt-get install libtest-www-selenium-perl
still i get same error
$ perl -e 'use Selenium::Remote::Driver;'
Can't locate Selenium/Remote/Driver.pm in #INC (you may need to install the Selenium::Remote::Driver module) (#INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Selenium::Remote::Driver is not part of Test::WWW::Selenium. From the documentation:
Installation
It's probably easiest to use the cpanm or CPAN
commands: bash $ cpanm Selenium::Remote::Driver

Related

Can't locate scripts/Config.pm in #INC (you may need to install the scripts::Config module)

Can't locate scripts/Config.pm in #INC
(you may need to install the scripts::Config module)
(#INC contains:
/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.24.1
/usr/local/share/perl/5.24.1
/usr/lib/x86_64-linux-gnu/perl5/5.24
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.24
/usr/share/perl/5.24
/usr/local/lib/site_perl
/usr/lib/x86_64-linux-gnu/perl-base
) at scripts/Training.pl line 54.
(Line breaks added for readability)
I have tried to install the module with cpan install scripts::Config, but it doesn't work.
Loading internal null logger. Install Log::Log4perl for logging messages
Reading '/home/japangly/.cpan/Metadata'
Database was generated on Thu, 03 Jan 2019 13:29:03 GMT
Warning: Cannot install scripts::Config, don't know what it is.
Try the command
i /scripts::Config/
to find objects with matching identifiers.
I tried to create links in /usr/local but it is empty:
ln -s /usr/{,local/}lib/perl5/5.8.3
ln -s /usr/{,local/}lib/perl5/site_perl/5.8.3
https://www.perlmonks.org/?node_id=746288
I use google cloud platform:
$ which perl /usr/bin/perl
$ perl -e "print join(\"\n\", #INC);"
/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.24.1
/usr/local/share/perl/5.24.1
/usr/lib/x86_64-linux-gnu/perl5/5.24
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.24
/usr/share/perl/5.24
/usr/local/lib/site_perl
/usr/lib/x86_64-linux-gnu/perl-base
The error message is:
Can't locate scripts/Config.pm ... at scripts/Training.pl line 54
The lines 53 and 54 look like
#line 53
$| = 1; if ( #ARGV < 1 ) { print "usage: Training.pl Config.pm\n"; exit(0); } # load configuration variables
require( $ARGV[0] );
The script expects to be run from the directory where the file Config.pm exists. Maybe alternatively you can run it as perl scripts/Training.pl scripts/Config.pm or put Config.pm into the current directory instead of having it in scripts/.
You might want to add . to the module search path by adding the following line to scripts/Training.pl, to future-proof it when upgrading Perl from 5.24 to a newer version:
use lib '.';

unavailable cpan in cygwin

I have unsuccessfully tried to install Perl module in cygwin like in an answer. I have got the following error:
$ perl -MCPAN -e shell
Can't locate CPAN.pm in #INC (you may need to install the CPAN module) (#INC contains: /usr/lib/perl5/site_perl/5.22/x86_64-cygwin-threads /usr/lib/perl5/site_perl/5.22 /usr/lib/perl5/vendor_perl/5.22/x86_64-cygwin-threads /usr/lib/perl5/vendor_perl/5.22 /usr/lib/perl5/5.22/x86_64-cygwin-threads /usr/lib/perl5/5.22 .).
BEGIN failed--compilation aborted.
How can I obtain cpan in my cygwin?
There are some additional details. Actually my purpose was to install ack like in answer. However, it didn't work. After installing I have got an error:
$ ack
Can't locate filetest.pm in #INC (you may need to install the filetest module) (#INC contains: /usr/lib/perl5/site_perl/5.22/x86_64-cygwin-threads /usr/lib/perl5/site_perl/5.22 /usr/lib/perl5/vendor_perl/5.22/x86_64-cygwin-threads /usr/lib/perl5/vendor_perl/5.22 /usr/lib/perl5/5.22/x86_64-cygwin-threads /usr/lib/perl5/5.22 .) at /home/loom/bin/ack line 218.
BEGIN failed--compilation aborted at /home/loom/bin/ack line 218.
The following was my trying to locate cpan
$ cpan
-bash: cpan: command not found
$ ll /usr/lib/perl5/5.22/CPAN.pm
ls: cannot access '/usr/lib/perl5/5.22/CPAN.pm': No such file or directory
$ find /usr/ -name *.pm | grep CPAN
/usr/lib/perl5/5.22/CPAN/Meta/Converter.pm
/usr/lib/perl5/5.22/CPAN/Meta/Feature.pm
/usr/lib/perl5/5.22/CPAN/Meta/History.pm
/usr/lib/perl5/5.22/CPAN/Meta/Merge.pm
/usr/lib/perl5/5.22/CPAN/Meta/Prereqs.pm
/usr/lib/perl5/5.22/CPAN/Meta/Requirements.pm
/usr/lib/perl5/5.22/CPAN/Meta/Spec.pm
/usr/lib/perl5/5.22/CPAN/Meta/Validator.pm
/usr/lib/perl5/5.22/CPAN/Meta/YAML.pm
/usr/lib/perl5/5.22/CPAN/Meta.pm
/usr/lib/perl5/5.22/Parse/CPAN/Meta.pm
Reinstalling perl helped.
$ apt-cyg install perl

How to update perl module with cpanm

I try to install/update Perl module with cpanm. But, it failed for every modules.
for example:
cpanm Config::General
--> Working on Config::General
Fetching http://www.cpan.org/authors/id/T/TL/TLINDEN/Config-General-2.56.tar.gz ... OK
Configuring Config-General-2.56 ... OK
Building and testing Config-General-2.56 ... OK
Successfully installed Config-General-2.56 (upgraded from 2.52)
1 distribution installed
So, i expect that version of Config::General is now 2.56, but... :
perl -e 'use Config::General 2.56'
Config::General version 2.56 required--this is only version 2.52 at -e line 1.
I try the same logged in superU but same problem...
But now, i have Perl lib in
~/perl5/lib/perl5/ and /usr/lib/perl/5.18/
How can i properly update Perl modules with cpanm?
Some information about my install:
$ perl -E'
say "$_=$ENV{$_}" for qw( PERL_MM_OPT PERL_MB_OPT PERL5LIB );
say "--";
say for #INC;
'
PERL_MM_OPT=INSTALL_BASE=/home/hacklionex/perl5
PERL_MB_OPT=--install_base "/home/hacklionex/perl5"
PERL5LIB=
--
/etc/perl
/usr/local/lib/perl/5.18.2
/usr/local/share/perl/5.18.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.18
/usr/share/perl/5.18
/usr/local/lib/site_perl
.
Your are instructing the module installers to install modules in /home/hacklionex/perl5 (via PERL_MM_OPT and PERL_MB_OPT), but you don't tell Perl to look for modules there (it's not in #INC). Add the following to your login script:
export PERL5LIB=/home/hacklionex/perl5/lib/perl5
Or add the following to your script:
use lib '/home/hacklionex/perl5/lib/perl5';

Can't locate Email/Sender/simple.pm

I want to send an email using perl Email module. I have installed Email::Sender. After running the following
sudo perl -MCPAN -e shell
install Email::Sender
and it says Email::Sender is up to date.
But when I run my script I get the following error:
Can't locate Email/Sender/simple.pm in #INC (#INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./first.pl line 8.
BEGIN failed--compilation aborted at ./first.pl line 8.
Script:
use Email::Sender::simple qw(sendmail); #line 8
use Email::Simple; #line 9
Any help appreciated.
The module is called Email::Sender::Simple (with two capital S characters), not Email::Sender::simple
Although in perl-CPANEL shows the library installed correctly, it doesn't work, you can try next:
1) install epel repository from rpm (you can find it easy, by searching on google)
2) issue yum repolist
3) issue yum install perl-Mail-Sender.noarch

Bash error in perl script using HTML::Scrubber

USER:~/Directory>curl http://www.w3schools.com/html/html_tables.asp | html.parser2.pl
Can't locate HTML/Scrubber.pm in #INC (#INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5 /usr/share/perl5 /usr/lib64/perl5 /usr/share/perl5 /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl .) at ./html.parser2.pl line 2.
BEGIN failed--compilation aborted at ./html.parser2.pl line 2.
What's happening here?
What's happening is that perl can't find the HTML::Scrubber module, which is required somewhere in the html.parser2.pl script.
Usually, the fix is to install it with cpan
cpan HTML::Scrubber
or possibly one of
sudo cpan HTML::Scrubber
<perl> -MCPAN -e 'install "HTML::Scrubber"'
where <perl> is the full path to the version of perl in the html.parser2.pl script's shebang line.
This solution might not work for a number of reasons (cpan can fail building and installing the module, you have more than one version of perl on your system and you are installing the module in the "wrong" version, ...). If cpan doesn't fix your problem, ask another question here including all the relevant output from the cpan process and from your command line invocation of the script.