Reputation: 31
I am creating a sample script using perl for Selenium WebDriver. I have downloaded selenium-server-standalone-2.32.0.jar file and I am executing following code:
use Selenium::Remote::Driver;
use Test::More qw( no_plan ) ;
my $driver = new Selenium::Remote::Driver();
$driver->get("http://www.google.com");
$driver->find_element('q','name')->send_keys("Hello WebDriver!");
ok($driver->get_title =~ /Google/,"title matches google");
$driver->quit();
but for this code to work I have to start java server using following command:
java -jar selenium-server-standalone-2.32.0.jar
Do I have to explicitly start the server to run the script? Or, there is something else I can do like setting environment variable etc. so that I don't have to start the server like in java we don't explicitly start the server.
Upvotes: 3
Views: 2600
Reputation: 137
You can also use this, so you don't have to start the Selenium Server yourself:
`use Selenium::PhantomJS;`
`my $driver = Selenium::PhantomJS->new;`
Upvotes: 0
Reputation: 126
In order to use any of the "unofficial bindings" (like the Perl bindings) you need to first launch the standalone-server jar file. As well, you need to do this in all the bindings if the browser is opening in a machine other than where the script is running (e.g. using RemoteWebdriver).
Hope that helps.
Upvotes: 0
Reputation: 47869
The documentation clearly states:
To use this module, you need to have already downloaded and started the Selenium Server (Selenium Server is a Java application).
Upvotes: 3