Hi There!
I am trying to drive the Selenium WebDriver using Perl. The complete context is I am testing on a window10 machine, testing against firefox 50. I have not installed the Selenium server, because I do not need to - the package Selenium::Remote::Driver (available in CPAN) uses the geckodriver. My goal is to open a website, enter texts in the fields, press a button and take a picture - all from using my script.What I have been able to do so far is the following: I can open a website from the script and can see it open in the window. I can even find a particular element on the screen (in the code snippet a field to accept text and a button) using the xPATH. This runs without error and when I print out the instantiated objects (see below) I get what I am looking for and no errors.
Here is the code - its the commented out lines that are giving me trouble.
#!C:\perl64\bin perl64 -w use Selenium::Remote::Driver; use Selenium::Firefox; use Test::Selenium::Firefox; use Selenium::Remote::WebElement; use Selenium::Remote::WDKeys; print "Starting New\n"; my $driver = Selenium::Firefox->new( marionette_enabled => 1, firefox_binary => "C:\Program Fil +es (x86)\Mozilla Firefox" ); $driver->get('http://144.76.109.38/peTEST'); #works my $elem = $driver->find_element_by_xpath(".//input[\@id='user_login_n +ame']"); print $elem."\n"; #$elem->send_keys('Superuser'); my $otherElem = $driver->find_element_by_xpath(".//*[\@id='user_login' +]\/tbody\/tr[4]\/td\/table\/tbody\/tr\/td[2]\/input"); print $otherElem."\n"; sleep(15), $driver->shutdown_binary;
When I comment in the send_keys line, I get the following error.
Use of uninitialized value in substitution iterator at C:/Perl64/site/ +lib/Selenium/Remote/Commands.pm at line 437 Use of uninitialized value in has element at C:/Perl64/site/lib/Seleni +um/Remote/ErrorHandler.pm at line 126 Error while executing command sendKeysToElement at C:/Perl64/site/lib/ +Selenium/Remote/Driver.pm at line 313. at C:/Perl64/site/lib/Selenium +/Remote/Driver.pm at line 313
I cannot tell if it is my code or not which is causing the problem, and the documentation online in (for example) MetaCPAN ist a bit lacking. I have tried to contact the current Selenium::Remote::Driver guys, but haven't gotten an answer yet.
Here is deal - if we can get this figured out quickly enough, I will do a full scale write up and disseminate the knowledge to the world. OK?
Thanks to all Monks - Tom ("novice")
In reply to Need Help with Selenium and Perl by proarchcon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |