开发者

Configuring Selenium RC with Perl

开发者 https://www.devze.com 2023-01-04 03:29 出处:网络
I want to use Selenium RC wit开发者_如何学JAVAh a Perl client driver. How can I configure Selenium RC with Perl?Use the WWW::Selenium module to link up to Selenium RC.

I want to use Selenium RC wit开发者_如何学JAVAh a Perl client driver. How can I configure Selenium RC with Perl?


Use the WWW::Selenium module to link up to Selenium RC.

You will need to have Selenium RC running in the background in order for it to operate. A technique that I have found useful to launch it from within Perl is to execute it on a separate thread and then immediately detach it:

use threads;

my $seleniumThread = # Assumes that your Selenium RC file is in the current dir
   threads->create( sub { system "java -jar selenium-server.jar"; } );

$seleniumThread->detach;
# Avoids the main program from having to wait for the system call to end

The following question may be useful as well:

  • How can I use Perl to scrape a website that reveals its content with Javascript?


Just a heads-up... for Selenium 2.0, you'll want to use the Selenium::Remote::Driver module instead; WWW:Selenium is for 1.0.

From the Selenium docs (http://seleniumhq.org/docs/03_webdriver.html):

Perl bindings are provided by a third party, please refer to any of their documentation on how to install / get started. There is one known Perl binding as of this writing. [with a link to https://metacpan.org/module/Selenium::Remote::Driver]

0

精彩评论

暂无评论...
验证码 换一张
取 消