I want to use Selenium RC with 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]
Related
The Saxon website says Saxon/C can be invoked from Perl, but I can't find any examples. The only thing I've found that interfaces to Saxon is one old Perl module (XML::Saxon::XSLT2) which uses Inline::Java and apparently is very slow. But I can find nothing that uses Saxon/C. Has anyone had any success in doing this who can share some tips?
we have not yet officially done the integration work needed to extend Saxon/C on perl it is still on our todo list. Therefore we currently don't support it. I don't know of anyone who has done this work as yet but I know it is can be done.
On the Saxon website we state that it is possible to create extensions in languages like Perl since Saxon/C has a C/C++ interface. Currently, we only have extensions for PHP and Python (available in the next release).
As a workaround you could run the transform command from Saxon/C using the exec function in Perl instead of the Java version, therefore avoiding the need to run Java VM.
I have mounts of a remote source code repos in Linux servers.
I use Eclipse Epic and I have made links to the scripts there with the help of the answer of this post.
My problem is the following:
The project in the remote repository uses a specific version of Perl which is under a specific directory.
How would I configure my project in Eclipse to have/use exactly the same Perl?
I haven't tested this with an interpreter on a remote machine and I'm on Windows but I think this would work.
Go to Window -> Preferences -> Perl EPIC
Click ... next to Perl executable and choose the location you want (this would be under your remote repository)
Click Apply / OK
To check if it works, just do this:
use strict;
use warnings;
print "Version: $]\n";
print "Interpreter: $^X\n";
I had the same question, because I have some Perl32 and Perl64 programs which I have to compile with different interpreters.
And think, the main question was:
"How can I use a particular perl interpreter for each project?"
EPICs preferences will change the interpreter for all projects, but not for a single one.
My solution was to create a small script as a wrapper for the perl interpreter.
Then, in the properties of each project, I added a meaningless Perl Include Path, which serves only as a hint on the interpreter, because EPIC passes this Include Path as a parameter to perl.
The wrapper script then looks for this hint and fires the right perl version.
I have downloaded strawberry PERL and writing one application with CGI Perl Apache on Winxp sp3).
One of the libraries (written by someone else) which I using uses XML::LibXML. When i load the page it gives Internal Server Error. From Apache error log i can see this error:
Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML: load_file:The specified module could not be found at C:/strawberry/perl/lib/DynaLoader.pm line 190.
C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll exists with all permissions.
Also this library works properly on Linux. My application also works fine if I remove all code that needs LibXML.
Can anyone tell me when can be possible issue here.
If you peek into the source for DynaLoader you'll find
Many dynamic extension loading problems will appear to come from
this section of code: XYZ failed at line 123 of DynaLoader.pm.
Often these errors are actually occurring in the initialisation
C code of the extension XS file. Perl reports the error as being
in this perl code simply because this was the last perl code
it executed.
You should have also gotten (but may not have noticed) the following dialog, which provides a more accurate error message:
The problem isn't that perl can't find LibXML.dll; it's that LibXML.dll can't find the real libxml. (The former is just a wrapper that provides Perl bindings for the latter.) To fix that you need to ensure that Strawberry Perl's c\bin folder is in your PATH. In your case, that would be C:\strawberry\c\bin.
You might have to check the environment variable settings in the windows,
make sure that the installation path of the module is present in the PATH variable.
The reason it works in linux is that make files usually set the environment variables for you in linux in windows it may not have set properly.
For eg;
go to Control Panel\System and Security\System click change settings then advanced tab in user variable section see if there is a variable called perl5lib.
if not create an new perl5lib variable and add the path of your library ( usuall C:\Perl\site\lib but may be different in your case)
I had the same issue after installing Strawberry perl. It was working fine when I run the script from server, but not remotely from a automation tool. The issue was because of the Environment variables not updated when we run it remotely. So I did server reboot, which resolved the issue.
I encountered the same problem recently, in my case it was not related to PATH variable (it was already correct). The thing is I was executing my script from Git Bash console and as it turned out git-bash perl was being used instead of Strawberry (see git-bash perl should not be first in path). Switching to standard Windows CMD terminal helped.
I am new to selenium 2.0 and working on automation through perl and java(maven-eclipse). I want to know the perl bindings for Se differ.
Selenium website shows https://metacpan.org/module/Selenium::Remote::Driver
While CPAN also has WWW:Selenium bundle....
Which to use to perl automation in this context?
Selenium::Remote::Driver is the one you want. WWW:Selenium is old.
You can visit the following URL:
http://repo1.maven.org/maven2/org/seleniumhq/selenium/client-drivers/selenium-perl-client-driver/
I have been working in a Perl script to read log files, but none of the people at work
want to use it as it requires run it from CLI, Im looking to integrate my Perl code which mainly
reads a txt file and produces and output (Already more than 2,000 lines) into a GUI which can be used with Windows or MAC PCs,
Example:
my perl script:
#./perl -i myfile
# HELLO this is the output!
Instead I want users to run the App and give them the chance to upload file and a Run button.
Thanks!
Then you can either write a web based frontend or use a GUI library such as Tk, Wx or Gtk.
Run as a CGI script which should ouput as HTML. For more you use template system like Template tool kit
In my experience, Tk is the most cross-platform GUI framework for Perl. It is very primitive (both in looks and API), but it works as expected almost everywhere with minimal fuss. Even with Gtk, I found there were some combinations of platforms and Perl deployments that just wouldn't work.
If you want to go the CGI route, try POEx::HTTP::Server. This will run a small web server within Perl without needing all the configuration of a full web server like Apache.