www-mechanize-firefox

How to use synchronize method with WWW::Mechanize::Firefox?

冷暖自知 提交于 2019-12-12 19:25:11
问题 I'm using WWW::Mechanize::Firefox and am trying to use the synchronize method like so: $mech->get('http://example.com/wp-login.php'); $mech->submit_form( with_fields => {log => 'admin', pwd => 'password'}); $self->synchronize( 'DOMContentLoaded', sub {print Dumper($self->title()); }); exit; The title of the newly loaded page prints but then the script just hangs. It never exits. What am I missing? 回答1: The subroutine that you pass to synchronize is meant to do something that kicks off an

Issue with eval_in_page - Trying to interpolate an array

假装没事ソ 提交于 2019-12-12 03:56:20
问题 my @para_text = $mech->xpath('/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[2]/td/table/tbody/tr[3]/td/div/div/div', type => $mech->xpathResult('STRING_TYPE')); #BELOW IS JUST TO MAKE SURE THE ABOVE CAPTURED THE CORRECT TEXT print "Look here: @para_text"; $mech->click_button( id => "lnkHdrreplyall"); $mech->eval_in_page('document.getElementsByName("txtbdy")[0].value = "@para_text"'); In the last line of my code I need to put the contents of the @para_text array as the text to output

How do you give WWW::Mechanize::Firefox permission to launch Firefox?

别等时光非礼了梦想. 提交于 2019-12-11 03:53:58
问题 I'm on a Mac. I've got a simple Perl script that uses WWW::Mechanize::Firefox to pull up a web page. The script works perfectly when Firefox is already open and running on my computer. Here's the line the creates the object: my $mech = WWW::Mechanize::Firefox->new( launch => '/Applications/Firefox.app' ); However, when Firefox is shutdown and I run the script, I get the following error: exec failed: Permission denied at /Library/Perl/5.12/MozRepl/RemoteObject.pm line 463 at /Library/Perl/5.12

Perl WWW::Mechanize::Firefox timeout implementation

萝らか妹 提交于 2019-12-08 03:58:08
问题 I am using WWW::Mechanize::Firefox along with MozRepl plugin in Firefox. The code works properly to fetch content from sites by sending them an HTTP GET request. I am going through a list of URLs and sending an HTTP GET Request to each of them. However, if the request hangs on a particular URL, it keeps waiting. Please note that I am referring to cases where a part of the web page content is loaded while some of the content is still pending. It happens in cases where a web page loads a lot of