When I run the command:
/usr/bin/chromium --user-data-dir=/home/rwk/chrome-session-for-walmart
+ https://grocery.walmart.com/orders
from a shell, chrome properly logs me in (from walmart cookies) and gets/displays my order page.
However when I run the code below (same data dir, same chrome binary, same page) it *fails* to read the walmart login cookies and instead gets the walmart login page (as I can see in /tmp/out.html). The login page uses captchas, so the cookie approach is the only option to gain login status, but it is not working.
I have been searching the web and the perl docs for days with no success. How can I make WMC load my order page?
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 => 1,
start_url => 'https://grocery.walmart.com/orders',
data_directory => '/home/rwk/chrome-session-for-walmart',
incognito => 0,
launch_exe => '/usr/bin/chromium',
);
$mech->allow(javascript => 1);
my $txt = $mech->content;
open($f, '>', '/tmp/out.html');
print $f $txt;
close $f;
P.S. From another post, I am told that without headless mode, two windows open (a known bug), with WMC attached to an incognito window (which understandably does not read the cookies - no account). I have not found a way around this.
P.P.S. My understanding is that using: data_directory => '/home/rwk/chrome-session-for-walmart' should allow WMC to save/load cookies automatically. Is that correct?