Re: How to receive events (eg. user mouse clicks) from IE



Resurrecting an old thread..
It seems that this solution does not return events on objects within
frames in webpages eg . if you go to www.andersondirect.com - the page
is composed of three frames called as topFrame main and address. Now
when I click on say 'Select a Vehicle' which is within main - I do not
get any Onclick event. I also do not get an OnMousemove event if I move
the mouse. However, I do get on Mousemove event on a tag called as
frameset (which is part of the top page).
How does one get events from the frames then?
As always thanks a lot.

Roger Upole wrote:
> <cal_2pac@xxxxxxxxx> wrote in message
> news:1116792093.323847.312700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> ...
> > The problem is that msdn documentation says that in order to identify
> > the element that was clicked - one has to query on IHTMLWindow2::event
> > property on iHTMLWindow2 interface to get IEventOBj interface and then
> > from there - use query interfce to get to the id of the element.
> >
> > How do I do this in python? ie. I have this code
> > class Doc_Events(doc_mod.HTMLDocumentEvents):
> > def Ononclick(self):
> > print 'onClick fired '
> > and I see onClick being trapped.
> > Now I need to go and get a reference to the iHTMLWindow2 interface. For
> > this I need to get a reference to doc_mod (as far as I can see). How do
> > I get that in the OnonClick method above.
>
> To get the IHTMLWindow2, you can just use self.parentWindow
> inside the event hander, and then get the event from it. And then
> the event's srcElement should be what you need.
>
> class Doc_Events(doc_mod.HTMLDocumentEvents):
> def Ononclick(self):
> print 'onclick'
> ev=self.parentWindow.event
> src=ev.srcElement
> print 'tagName:',src.tagName,'name:',src.getAttribute('name')
>
> For clicking on google's input field, this yields
> tagName: INPUT name: q
>
> >
> > b) You had mentioned PumpWaitingMessages in the previous posting. I
> > first encountered this on newsgroup postings. None of the standard
> > books (python on win32 / python developer) seem to explain this in
> > detail although this seems to be commonly used. Though I understand
> > this now - my problem is that there seems to be a lack of cohesive
> > explanation on how python ties up with COM (despite a good chapter 12
>
> PumpWaitingMessages is just a way to ensure that normal message processing
> (window messages, events, dde, etc) happens while python code is running.
> Normally you don't need it, but every once in a while you hit a situation
> where
> blocking occurs.
>
> For how exactly python interacts with COM, the source is your best bet.
>
> Roger
>
>
>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
> ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

.



Relevant Pages

  • Re: How to receive events (eg. user mouse clicks) from IE
    ... > How do I do this in python? ... > Now I need to go and get a reference to the iHTMLWindow2 interface. ... > first encountered this on newsgroup postings. ... PumpWaitingMessages is just a way to ensure that normal message processing ...
    (comp.lang.python)
  • Re: How to receive events (eg. user mouse clicks) from IE
    ... Each frame acts as a separate document. ... >>> Now I need to go and get a reference to the iHTMLWindow2 interface. ... >> PumpWaitingMessages is just a way to ensure that normal message processing ... >> happens while python code is running. ...
    (comp.lang.python)
  • Re: Memory leak/gc.get_objects()/Improved gc in version 2.5
    ... The memory consumption of the program grows as the number of frames ... The memory usage vs. frame number graph shows some big "jumps" at ... I upgraded to Python 2.5. ...
    (comp.lang.python)
  • Re: HTML Templates (Sitemesh/Tiles concept) in Python
    ... I am a newbie to python and web development. ... We are using frames to do the ... Is there a template logic like Sitemesh or Tiles ... Have you considered using one of the existing python web development ...
    (comp.lang.python)
  • Re: Creating frames in threads
    ... Windows, and the problem in this newsgroup thread ALSO seems to be a ... WindowsPython 2.3.3-only problem. ... > those frames around after the thread is gone? ...
    (comp.lang.python)