Perl WWW::Mechanize::Firefox timeout implementation -


i using www::mechanize::firefox along mozrepl plugin in firefox. code works fetch content sites sending them http request.

i going through list of urls , sending http request each of them.

however, if request hangs on particular url, keeps waiting.

please note referring cases part of web page content loaded while of content still pending. happens in cases web page loads lot of content third party sites , if 1 of resources (an image instance) not loaded, browser keeps waiting it.

i want request timeout after 'n' seconds can read next url list , continue code execution.

in www::mechanize perl module, constructor supported timeout option shown below:

$mech=www::mechanize->new(timeout => 10); 

however, not find similar option in documentation perl module, www::mechanize::firefox here:

http://metacpan.org/pod/www::mechanize::firefox

i tried this:

$mech=www::mechanize::firefox->new(timeout => 10); 

but think not work there still sites request hangs.

www::mechanize::firefox uses mozrepl connect firefox browser, don't need declare timeout parameter, because firefox wait page load.

if want check if site loaded, should check element want (e.g. div) present:

while (!$mech->is_visible( xpath => '//div[@class="mydivclassathtml"]')) {           sleep 1; };  # page 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -