This is similar to a question posted just now. Are you using WWW::Mechanize or some module that uses an actual browser (like Win32::IE::Mechanize or Mozilla::Mechanize)?
You can click on links, but if you are using Mech, you won't be able to run the javascript. If you know enough javascript you could probably re-write the function into Perl, otherwise use a Mech that has a browser backend.
| [reply] |
James2Vegas, Thanks for the reply. I am using Win32::IE::Mechanize. I was able to click on "buttons" (like "sign in" in gmail etc. ) on pages with the click and click_button functions but not "text links" (like the names of Other Users listed in the panel, right hand side of your page).
Is there a work around to do this?
Please enlighten me..
Thanks,
Eshwar.
| [reply] |
Using the base Win32::IE::Mechanize object you can get the agent which is the Internet Explorer Automation object and from there you can get the Document object, basically equivalent to the Document object in DOM/Javascript.
Thanks to Anonymous Monk downthread, we learn that Microsoft's "relaxed" attitude towards standards allows the OP to indeed use the click() method on their links.
Unfortunately the click() method only works on input elements, not links, so you would need to work out how the link calls the javascript. If the links' hrefs were set to javascript urls, doing something like $ie->get('javascript:codehere') (where that matches the href of the link) would also work, but if it is attached as an event handler you would need to execute the code in the event handler.
Failing all this, you could work out what the javascript is doing in terms of submitting and retrieving data and use Mech to reproduce it.
| [reply] [d/l] |