in reply to Re: WWW:Mechanize::Chrome cookies
in thread WWW:Mechanize::Chrome cookies

Great! That almost works... But, it opens two (2) chrome windows, one in "incognito" mode at "grocery.walmart.com" and one chrome window *not* in incognito mode (regular mode?) at "about:blank". Although the docs say incognito defaults to false, I set it to 0 (zero) anyway but it makes no difference and the docs say nothing more regarding incognito. I can manually close the walmart page (which, btw, is not reading the login cookies) then go to walmart in the non-incognito window and YES, it then works. However, I need to make it open walmart in one non-incognito window automatically, and I should be good to go...

Any additional help is greatly appreciated!

My code now:

use Log::Log4perl qw(:easy); use WWW::Mechanize::Chrome; Log::Log4perl->easy_init($ERROR); # Set priority of root logger to ER +ROR my $mech = WWW::Mechanize::Chrome->new( headless => 0, data_directory => '/home/rwk/chrome-session-for-walmart', incognito => 0, ); $mech->get('https://grocery.walmart.com'); my $png = $mech->content_as_png();

P.S. How do I select between the two open chrome windows? I can't find it anywhere in the docs...

Replies are listed 'Best First'.
Re^3: WWW:Mechanize::Chrome cookies
by Corion (Patriarch) on May 24, 2020 at 17:34 UTC

    With version 0.58 , the second window should not open anymore unless you specify separate_session in the constructor.

    Also, it should make the cookies available that are stored in the data_directory.