Re: Simulating clicks on the DOM node of the GMAIL page.
"Amit Saurav" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Hello Martijn,
I tried using the sendMouseEvent using the following code:
var req = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
var utils = req.getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendMouseEvent("mousedown", xCor, yCor, 0, 1, 0);
utils.sendMouseEvent("mouseup", xCor, yCor, 0, 1, 0);
Here xCor and yCor are the position where I want to click. But still
it does not work and i get an exception saying:
Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
[nsIDOMWindowUtils.sendMouseEvent]
Any ideas as to why this is happeneing? My code executes with chrome
priveledge from an extension in firefox, and I am trying to simulate a
click on an element present on the page.
I appreciate your help.
Thanks,
Amit
On Tue, Feb 26, 2008 at 8:10 AM, Martijn <[email protected]> wrote:
> I don't know if you're using trunk or branch, but if you're using
> trunk and you have chrome privileges, you can use the sendMouseeEvent
> from nsIDOMWindowUtils:
> http://lxr.mozilla.org/seamonkey/source/dom/public/idl/base/nsIDOMWindowUtils.idl
>
> Regards,
> Martijn
>
>
> On 2/26/08, stony_dreams <[email protected]> wrote:
> > Hello:
> >
> > I want to simulate click events on the elements on the Gmail page.
> > Problem is, i am able to simulate it on the elements on the side bar
> > (viz. compose mail, inbox, etc) but was not able to use the same
> > function for the actual emails.
> >
> > I suspected this to be a security issue as when i do a createEvent(),
> > it should correspond to the document object of the container frame.
> > But this also did not work. Sometimes, the page just hangs when my
> > simulate click function is called. I am not sure whether gmail is
> > doing somethin fishy... Can anybody shed some light?
> >
> > I used the normal click function on the mozilla examples page:
> > http://developer.mozilla.org/en/docs/DOM:document.createEvent and i am
> > sure that i am calling this function on the exact element on the DOM,
> > which i confirmed using the DOM inspector.
> >
> > Thanks in advance...
> > _______________________________________________
> > dev-tech-dom mailing list
> > [email protected]
> > https://lists.mozilla.org/listinfo/dev-tech-dom
> >
>
>
> --
> Martijn Wargers - Help Mozilla!
> http://weblogs.mozillazine.org/qa/
> http://wiki.mozilla.org/Mozilla_QA_Community
> irc://irc.mozilla.org/qa - /nick mw22
>