How to receive events (eg. user mouse clicks) from IE
rupole at hotmail.com
Mon Jun 13 02:21:51 CEST 2005
Each frame acts as a separate document.
You should be able catch document events
from a frame using something like
win32com.client.DispatchWithEvents(ie.Document.frames(<nbr of frame>).document, <your event class>)
<cal_2pac at yahoo.com> wrote in message news:1118544283.178003.277370 at g47g2000cwa.googlegroups.com...
> 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 at yahoo.com> wrote in message
>> news:1116792093.323847.312700 at g49g2000cwa.googlegroups.com...
>> > 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'
>> 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
>> blocking occurs.
>> For how exactly python interacts with COM, the source is your best bet.
>> ----== 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 =---
----== 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 =---
More information about the Python-list