in reply to Re: Is it possible to trigger a mouse click action in a browser using Perl?
in thread Is it possible to trigger a mouse click action in a browser using Perl?

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.
  • Comment on Re^2: Is it possible to trigger a mouse click action in a browser using Perl?

Replies are listed 'Best First'.
Re^3: Is it possible to trigger a mouse click action in a browser using Perl?
by james2vegas (Chaplain) on Aug 14, 2009 at 11:13 UTC
    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.

        From the DOM HTML Level One Spec, where click() is

        click: Simulate a mouse-click. For INPUT elements whose type attribute has one of the following values: "Button", "Checkbox", "Radio", "Reset", or "Submit".
        This method has no parameters.
        This method returns nothing.
        This method raises no exceptions.
        at