Perlchaoui has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am requesting all your wisdom and your skills ( normally just one or two skills not more :) ) please
I am trying to recover datas ( url's ) from my config file which is an excel file. Information's are in the first column of the sheet; For each data obtained, i would like to add the data, the URL in the adress bar of chrome to run with the browser.
Here is the code
Here the output i get in my cmd#!/usr/bin/perl use strict; use warnings; use Test::More; #use Test::Time; use Selenium::Remote::Driver; use Selenium::Remote::WebElement; use Spreadsheet::Read; use Text::CSV_XS; my $driver = Selenium::Remote::Driver->new( 'remote_server_addr' => 'localhost', 'browser_name' => 'chrome', 'port' => '4444', ); my $excel = ReadData ("TEST.csv"); my $data = $excel->[1]{A1}; foreach my $data (0..9){ $driver->get($data); $driver->maximize_window(); #$driver->find_element('q','name')->send_keys($data); $driver->pause(2000); $driver->send_keys_to_active_element(KEYS->{'control'}, 't'); $driver->pause(2000); my $filename = "screenshot.png"; $driver->capture_screenshot($filename); $driver->pause(2000); } $driver->quit();
C:\Users\user1\Documents\TESTPERL>perl TEST6.pl Error while executing command: invalid argument: 'url' must be a strin +g (Session info: chrome=70.0.3538.77) (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e +332711d2874a),platform=Windows NT 6.1.7601 SP1 x86_64) at C:/Strawber +ry/perl/sit e/lib/Selenium/Remote/Driver.pm line 391. at C:/Strawberry/perl/site/lib/Selenium/Remote/Driver.pm line 348.
What is going wrong please?
Is there an other (better) way to do it ? I know that TIMTOWTDI (Perl !!). I'm not sure, i am thinking about a hash or something like that but as i am a beginner i don't know how to do it exactly. Instead of having a simple loop and have to change the incrementation...
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recover Excel data from cells with Foreach loop
by poj (Abbot) on Nov 10, 2018 at 18:18 UTC | |
by Perlchaoui (Sexton) on Nov 10, 2018 at 20:57 UTC | |
by poj (Abbot) on Nov 10, 2018 at 21:46 UTC | |
by Perlchaoui (Sexton) on Nov 10, 2018 at 22:33 UTC | |
by 1nickt (Canon) on Nov 10, 2018 at 23:37 UTC | |
|