in reply to Re^2: No Elements Found with WWW::Mechanize::PhantomJS
in thread No Elements Found with WWW::Mechanize::PhantomJS

This is really weird. For me, the below program works and outputs the HTML that I somewhat expect:

use strict; use WWW::Mechanize::PhantomJS; use Data::Dumper; my $mech = WWW::Mechanize::PhantomJS->new( launch_arg => ['ghostdriver/src/main.js' ], ); $mech->get('https://www.racingpost.com/tipping/naps-table/'); sleep 5; my $cont= $mech->selector('.tn-napsTable', one => 1 ); my $content=$cont->get_attribute('innerHTML'); print $content; __END__ <div class="tn-napsTable__header"><div class="tn-napsTable__main"><div + role="but ton" tabindex="0" class="tn-napsTable__cell tn-napsTable__cell_header +tn-napsTab le__napsTipster_header"><!-- react-text: 15 -->Today's naps / Tipster< +!-- /react -text --></div><div role="button" tabindex="0" class="tn-napsTable__ce +ll tn-naps ...

This is with PhantomJS v 2.1.1 on Windows and WWW::Mechanize::PhantomJS 0.18.

Replies are listed 'Best First'.
Re^4: No Elements Found with WWW::Mechanize::PhantomJS
by rmperl (Novice) on Jun 08, 2018 at 12:24 UTC

    Thank you so much for this. Works fine now that I've upgraded PhantomJS to v2.1.1. I was running the code before using an earlier version of PhantomJS v1.9 on Ubuntu 16.04