use Data::Dumper; use WWW::Mechanize::Chrome; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($TRACE); my $url = "http://bcu-guides.unifr.ch/fr/subjects/ref#tabs-0"; my $mech = WWW::Mechanize::Chrome->new(); $mech->get($url); print $mech->status, "\n"; print $mech->title(), "\n"; die ( "No response : status line is ", $mech->status ) unless ( $mec +h->success );
The page loaded is a blank page, and not the page at the $url address ... The Log output is
U:\docs\perl\zotero>get_wdata.pl 200 about:blank U:\docs\perl\zotero>get_wdata.pl 2018/03/20 11:21:33 Spawning $VAR1 = [ 'chrome', '--remote-debugging-port=9222', '--disable-gpu', 'about:blank' ]; 2018/03/20 11:21:36 Created new tab $VAR1 = { 'url' => 'about:blank', 'description' => '', 'type' => 'page', 'id' => '(F74FF8EFADCAAEAB7D6D5B4DF4F714E)', 'webSocketDebuggerUrl' => 'ws://127.0.0.1:9222/devtools/page +/(F74FF8EFADCAAEAB7D6D5B4DF4F714E)', 'devtoolsFrontendUrl' => '/devtools/inspector.html?ws=127.0. +0.1:9222/devtools/page/(F74FF8EFADCAAEAB7D6D5B4DF4F714E)', 'title' => '' }; 2018/03/20 11:21:36 Connecting to ws://127.0.0.1:9222/devtools/page/(F +74FF8EFADCAAEAB7D6D5B4DF4F714E) 2018/03/20 11:21:36 Connected 2018/03/20 11:21:36 Sent message $VAR1 = '{"params":{},"id":0,"method" +:"Page.enable"}'; 2018/03/20 11:21:36 Sent message $VAR1 = '{"id":1,"method":"Network.en +able","params":{}}'; 2018/03/20 11:21:36 Sent message $VAR1 = '{"method":"Runtime.enable"," +id":2,"params":{}}'; 2018/03/20 11:21:36 Replying to 0 $VAR1 = { 'id' => 0, 'result' => {} }; 2018/03/20 11:21:36 Replying to 1 $VAR1 = { 'result' => {}, 'id' => 1 }; 2018/03/20 11:21:36 Ignored message $VAR1 = { 'method' => 'Runtime.executionContextCreated', 'params' => { 'context' => { 'auxData' => { 'frameId' => '(F +74FF8EFADCAAEAB7D6D5B4DF4F714E)', 'isDefault' => b +less( do{\(my $o = 1)}, 'JSON::PP::Boolean' ) }, 'origin' => '://', 'id' => 1, 'name' => '' } } }; 2018/03/20 11:21:36 Replying to 2 $VAR1 = { 'result' => {}, 'id' => 2 }; 2018/03/20 11:21:36 Navigating to [about:blank] 2018/03/20 11:21:36 Sent message $VAR1 = '{"id":3,"method":"Page.navig +ate","params":{"url":"about:blank"}}'; 2018/03/20 11:21:36 Replying to 3 $VAR1 = { 'result' => { 'frameId' => '(F74FF8EFADCAAEAB7D6D5B4DF4F714E +)', 'loaderId' => '(90AA89AE5B68C5AA4E558EC1F56AE9 +7C)' }, 'id' => 3 }; 2018/03/20 11:21:36 No navigation occurred, not collecting events 2018/03/20 11:21:36 Navigating to [http://bcu-guides.unifr.ch/fr/subje +cts/ref#tabs-0] 2018/03/20 11:21:36 Sent message $VAR1 = '{"method":"Page.navigate","i +d":4,"params":{"url":"http://bcu-guides.unifr.ch/fr/subjects/ref#tabs +-0"}}'; 2018/03/20 11:21:36 Dispatching one-shot event $VAR1 = { 'params' => { 'frameId' => '(F74FF8EFADCAAEAB7D6D5B4DF4F714E +)' }, 'method' => 'Page.frameStartedLoading' }; 2018/03/20 11:21:36 Navigation started, logging 2018/03/20 11:21:36 Found frame id as (F74FF8EFADCAAEAB7D6D5B4DF4F714E +) 2018/03/20 11:21:36 Capturing events until 'Page.frameStoppedLoading' +for frame (F74FF8EFADCAAEAB7D6D5B4DF4F714E) 2018/03/20 11:21:36 Dispatching message $VAR1 = { 'params' => { 'frameId' => '(F74FF8EFADCAAEAB7D6D5B4DF4F714E +)' }, 'method' => 'Page.frameStartedLoading' }; 2018/03/20 11:21:36 Dispatching message $VAR1 = { 'params' => { 'executionContextId' => 1 }, 'method' => 'Runtime.executionContextDestroyed' }; 2018/03/20 11:21:36 Dispatching message $VAR1 = { 'params' => {}, 'method' => 'Runtime.executionContextsCleared' }; 2018/03/20 11:21:36 Dispatching message $VAR1 = { 'method' => 'Page.frameNavigated', 'params' => { 'frame' => { 'mimeType' => 'text/html', 'url' => 'about:blank', 'id' => '(F74FF8EFADCAAEAB7D6D5B4 +DF4F714E)', 'securityOrigin' => '://', 'loaderId' => '(1D0DADBEF9F01D6CF +33B616E1A598DB8)' } } }; 2018/03/20 11:21:36 Dispatching message $VAR1 = { 'params' => { 'context' => { 'id' => 2, 'name' => '', 'auxData' => { 'frameId' => '(F +74FF8EFADCAAEAB7D6D5B4DF4F714E)', 'isDefault' => b +less( do{\(my $o = 1)}, 'JSON::PP::Boolean' ) }, 'origin' => '://' } }, 'method' => 'Runtime.executionContextCreated' }; 2018/03/20 11:21:36 Dispatching message $VAR1 = { 'params' => { 'timestamp' => '1643765.185677' }, 'method' => 'Page.loadEventFired' }; 2018/03/20 11:21:36 Dispatching message $VAR1 = { 'method' => 'Page.frameStoppedLoading', 'params' => { 'frameId' => '(F74FF8EFADCAAEAB7D6D5B4DF4F714E +)' } }; 2018/03/20 11:21:36 Received final message, unwinding $VAR1 = { 'method' => 'Page.frameStoppedLoading', 'params' => { 'frameId' => '(F74FF8EFADCAAEAB7D6D5B4DF4F714E +)' } }; 2018/03/20 11:21:36 Ignored message $VAR1 = { 'params' => { 'timestamp' => '1643765.18599' }, 'method' => 'Page.domContentEventFired' }; 2018/03/20 11:21:36 Replying to 4 $VAR1 = { 'result' => { 'loaderId' => '(6775B90C0036886A177E258224CEE6 +63)', 'frameId' => '(F74FF8EFADCAAEAB7D6D5B4DF4F714E +)' }, 'id' => 4 }; 2018/03/20 11:21:36 Updated response object 200 about:blank
Any idea on how to have chrome loading the page ?

Thanks

F.

In reply to WWW::Mechanize::Chrome - loads a blank page by frazap

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.