Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: saveResources_future and tab in WWW::Mechanize::Chrome

by Corion (Pope)
on May 13, 2020 at 09:51 UTC ( #11116747=note: print w/replies, xml ) Need Help??


in reply to saveResources_future and tab in WWW::Mechanize::Chrome

This is weird. The documentation says:

my $file_map = $mech->saveResources_future( target_file => 'this_page.html', target_dir => 'this_page_files/', )->get();

... and the target_dir value is used to create the directory where to save the resources. Can you maybe show some code that demonstrates the behaviour?

Despite my regression tests, tab => 'current' seems to be broken for many people. This is still an issue under investigation unfortunately.

Replies are listed 'Best First'.
Re^2: saveResources_future and tab in WWW::Mechanize::Chrome
by 1nelly1 (Acolyte) on May 13, 2020 at 11:13 UTC

    Dear Corion,
    I only tested the code from the documentation (exactly as written above). And 'this_page.html' and all files will be placed in the working directory. I can change target_file location and save somewehere else but whatever location I use for target_dir, all files are always saved in the working directory.
    I am still using WWW::Mechanize::Firefox and would like to migrate to Chrome. Just for your information, I was not able to install WWW::Mechanize::Chrome with ActiveState Perl running despite your advice to force the installation of Imager::File::PNG if screenshots are not necessary. I tried to force the installation of Imager::File::PNG as well as WWW::Mechanize::Chrome using cpanm but it did not work. Now I am using Strawberry Perl
    Best regards
    1nelly1

      Thank you for making me revisit my assumptions!

      Indeed, the parameter for specifying the download directory was never used. This will be fixed in the next release of WWW::Mechanize::Chrome, which I will likely release this evening.

        Thank you! I think it was here:
        $names{ $resource->{url} } ||= File::Spec->catfile( $target_dir, $names{ $resource->{url} });
        Best regards
        1nelly1
Re^2: saveResources_future and tab in WWW::Mechanize::Chrome
by 1nelly1 (Acolyte) on May 13, 2020 at 11:26 UTC

    Dear Corion,
    regarding the tab problem I just want to emphasize that I have two separate Chrome windows when calling $mech->get.
    Best regards
    1nelly1

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11116747]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2020-10-29 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (274 votes). Check out past polls.

    Notices?