Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

WWW::Mechanize::Firefox Script Hangs after an Xpath click

by Matt™ (Acolyte)
on Nov 21, 2012 at 05:31 UTC ( #1004838=perlquestion: print w/ replies, xml ) Need Help??
Matt™ has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I am facing an issue with www::mechanize::firefox Click. I am clicking a button but it is hanging there. and it is not processing any next codes. Can you pls check the below codes pls,

use strict; use WWW::Mechanize::Firefox; my url= "**************************************"; my $mech = WWW::Mechanize::Firefox->new(timeout => 2 ); $mech->allow( javascript =>1); $mech->get($url); sleep(3); $mech->click({ xpath => '//span[@class="paginate_button"]' }, { xpath +=> '//*[contains(text(),"2")]' }); #print "First click ok" ; sleep(3); $mech->click({ xpath => '//span[@class="paginate_button"]' }, { xpath +=> '//*[contains(text(),"3")]' }); sleep(3);

Here it is hanging at the first click and not doing any next process. Here it stuck on $mech->click({ xpath => '//span[@class="paginate_button"]' }, { xpath =>  '//*[contains(text(),"2")]' }); and not coming out of that. I tried giving timeout also, but it is not taking. Is there any other way for this? The Url I tried on is  http://psacareers.gtisolutions.co.uk/VacancyPosting/Search?SearchText=&VacancyPostingFramework=&VacancyBusinessArea=&VacancyRegion=&submit=Search.

Thanks In advance Monks.

I just want the script to come out of that first click and do the rest process. Is there any other way to give timeout? I mean in www::Mechanize we can give like $mech->timeout(2); (but in www::mech::firefox I think we cant!)Thanks Monks.

Comment on WWW::Mechanize::Firefox Script Hangs after an Xpath click
Select or Download Code
Reaped: Reload: WWW::Mechanize::Firefox Script Hangs after an Xpath click
by NodeReaper (Curate) on Nov 21, 2012 at 17:02 UTC
Re: WWW::Mechanize::Firefox Script Hangs after an Xpath click
by choroba (Canon) on Nov 21, 2012 at 17:24 UTC
    When I try your script, but add log => ['debug'] to the constructor, the script prints the following over and over:
    [DEBUG] .------------+------------------------------------------. | type | content | +------------+------------------------------------------+ | command | repl.ejs("repl.getAttr(578,\"busy\")\n"- | | | ,""); | | | --end-remote-input | | result | "{"status":"ok","result":{"result":0,"t- | | | ype":null}}" | '------------+------------------------------------------'
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: WWW::Mechanize::Firefox Script Hangs after an Xpath click
by Corion (Pope) on Nov 22, 2012 at 00:37 UTC
    Have you read and investigated the reasons for such behaviour in WWW::Mechanize::Firefox::Troubleshooting? That page has a section named "Clicking on a link makes a script waiit forever". Maybe the solution there helps you.
      Thanks Corion.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1004838]
Approved by rovf
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (16)
As of 2015-07-06 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls