Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

WWW::Mechanize::Firefox hangs when jquery element clicked

by nysus (Parson)
on Feb 12, 2016 at 11:13 UTC ( [id://1155062]=perlquestion: print w/replies, xml ) Need Help??

nysus has asked for the wisdom of the Perl Monks concerning the following question:

I've got a form in WordPress that uses the "Chosen" jquery plugin for drop down <select> fields. I'm having a tough time automating these fields with WWW::Mechanize::Firefox. The website for the plugin is here.

When I click on the div tag associated with the drop down, it just hangs. Here is the code I'm using to click on it:

$mech->click({xpath => '//div[@id="saved_venue_chosen"]'}, synchronize + => 0);

The synchronize => 0 bit is supposed to prevent the script from waiting for a response from the server. However, I'm thinking that because clicking on the div tag causes jquery to change the classes of the div tag, it might be confusing WWW::Mechanize::Firefox.

I tried this:

my $i = $mech->xpath('//div[@id="saved_venue_chosen"]', one => 1); + $i->__event('focus'); $i->__event('click');

It didn't work. Any other workarounds I might try?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
$nysus = $PM . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: WWW::Mechanize::Firefox hangs when jquery element clicked
by nysus (Parson) on Feb 12, 2016 at 13:29 UTC

    OK, got it. Needed a 'mousedown' event like so:

    $i->__event('mousedown');

    Hopefully this will save someone the hours of time I lost on this one.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
    $nysus = $PM . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1155062]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found