Re: How to call a website in a frame?

cr <[email protected]> Tue, 24 Apr 2007 18:49:20 -0400
Newsgroups gmane.comp.mozilla.jrex
Message-ID <[email protected]>
Yes, you can simulate a mouse click by doing the following:

   1. Given a node, get the associated DocumentEvent
   2. Using the DocumentEvent object, create a new event whose eventType
      is "MouseEvents"
   3. Initialize the new event specifying the sub-type as "click" and
      the target as the node that should receive the click (see
      http://developer.mozilla.org/en/docs/DOM:event.initMouseEvent for
      more details)
   4. Dispatch this event using the event target associated with the DOM
      node to be clicked.

Here's the code :

     EventTarget relatedEventTarget = ((JRexNodeImpl)elm)
                                                       .getEventTarget();
     DocumentEvent event = ((JRexHTMLDocumentImpl)
                            elm.getOwnerDocument())
                           .getDocumentEvent();
     MouseEvent clickEvent = (MouseEvent)
                             event.createEvent("MouseEvents");
     // initMouseEvent described here:
     //    http://developer.mozilla.org/en/docs/DOM:event.initMouseEvent
     clickEvent.initMouseEvent("click", true, true, null, 1, 1, 2, 1, 2,
                               false, false, false, false, (short) 0,
                               relatedEventTarget);
     relatedEventTarget.dispatchEvent(clickEvent);

Hope that helps.

--Chris



Billy wrote:
> Well,
> a bit time as gone, Im goint to precicise my question.
> Is it possible to control a website where some frames are in use.
> For example I call a website where 4 frames are used and shown in 
> my JRex browser. Now I can click a link in of the frames so that 
> for example the content of that frame changes.
> Is it possible to simulate that click in Jrex. I want to invoke that websitecall
> inside of a frame of a given website.
> Thanks
> Billy