in reply to Re^3: Recover Excel data from cells with Foreach loop
in thread Recover Excel data from cells with Foreach loop

Hmmm ; I understand better now. Thx. I need to work more with the foreach loop

Further to that i have a latest remark Poj. I would like to make a screenshot once an url is opened; As i am in a loop, i would like to store for each url a screnshot file. I did quickly as follows. I got no error but i got no screenshot :)

I used your code

sub process { my ($url) = @_; print "Processing $url\n"; # selenium code etc $driver->get($url); $driver->maximize_window(); $driver->pause(2000); #my $filename = "screenshot.png"; #$driver->capture_screenshot($filename); my $path = "C:/Users/user1/Documents/TESTPERL"; $driver->capture_screenshot("$path/Website-$url.png"); $driver->pause(2000); }

Many thanks Poj

Replies are listed 'Best First'.
Re^5: Recover Excel data from cells with Foreach loop
by 1nickt (Canon) on Nov 10, 2018 at 23:37 UTC

    Hi, poj has the night off ;-)

    You don't check to see whether your call to capture_screenshot succeeded. It returns true if so, and nothing if it fails.

    $driver->capture_screenshot("$path/Website-$url.png") or warn "Didn't +get it!";

    Since the call is not raising an exception, it's hard to guess what the problem might be: if the file could not be opened or written to, you would have encountered a fatal error, for example. If you turn on debugging you might see some issue with the driver itself, or maybe diagnostics from the Perl module ...

    $driver->debug_on();

    Like I say I cannot really think of a cause of your issue: I have used the command successfully myself many times, FWIW.

    Hope this helps!


    The way forward always starts with a minimal test.

      Hello @lnickt !

      Thank you for your feedback.

      Yes i guess @Poj has got a life :)

      Indeed, yes, i have no trace of the issue..I tried as you recommanded with that

      $driver->debug_on();

      But i just got log from server and the information's are not clear on the potential issue.I will try again :)

      PS: A question: How is it possible to add a link to a monk for a reply. Like this : @Poj .For instance. Thanks

        You can use [poj] to create poj. Note that it creates a link, but doesn't notify the monk; there are only two ways how to notify: replying to one's node or sending a private message.

        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,