You also want to make sure the frame you want is loaded
I use the following method:
def _frameWait(self, frameName=None):
thisCount = self._timeOut
while self._ie.Busy:
time.sleep(0.1)
thisCount = thisCount - 1
if thisCount == 0: break
> <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > 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
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().document,
)
Roger
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Resurrecting an old thread..
> It
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 -
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
...
> 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 - u
> This might make a good candidate for the Cookbook (or there's
> a collection of IE automation examples at win32com.de)
> so anybody else trying to do something similar knows some of the
pitfalls.
This thread has been very valuable for me and has provided
clarifications which I could not get afte
Reducing the sleep time in the loop also seems to speed things up.
I'm guessing due to giving both event loops more resources, but
I can't prove it conclusively.
This might make a good candidate for the Cookbook (or there's
a collection of IE automation examples at win32com.de)
so anybody else try
"Roger Upole" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> There does appear to be some sort of conflict between the two event
> hooks. I wasn't seeing it before since IE was getting google from my
> browser cache and it was coming up almost instantaneously. As soon
> as I switch
There does appear to be some sort of conflict between the two event
hooks. I wasn't seeing it before since IE was getting google from my
browser cache and it was coming up almost instantaneously. As soon
as I switched the URL to a page that loads slowly, I got the same
result.
Adding win32gui
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks for the response again. The solution is pretty close but not yet
> complete
> This is what I observed.
> a) I tried to use the delay mechanism as suggested below
> ie.
> ie.Navigate('www.google.com')
> while ie.ReadyState !- 4
>
Thanks for the response again. The solution is pretty close but not yet
complete
This is what I observed.
a) I tried to use the delay mechanism as suggested below
ie.
ie.Navigate('www.google.com')
while ie.ReadyState !- 4
time.sleep(0.5)
d=win32com.client.DispatchWithEvents(ie.Document, Doc
Usually you get that error if you try to access the Document object
before the page has loaded. Try adding a delay after ie.Navigate,
something like
while ie.ReadyState<>4:
time.sleep(0.5)
There are some constants that show up in win32com.client.constants
that represent the ReadyState's, but
Thanks for your prompt responses and the code.
However, when I run the code I get com error
d=win32com.client.DispatchWithEvents(ie.Document, Doc_Events)
File "C:\Python23\lib\site-packages\win32com\client\__init__.py",
line 199, in __getattr__
return getattr(self._obj_, attr)
File "C:\Pyt
Here's a few more lines that hook the document's onactivate event.
import win32com.client
ie_mod=win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-C05BAE0B}'
,0, 1, 1)
doc_mod=win32com.client.gencache.EnsureModule('{3050F1C5-98B5-11CF-BB82-00AA00BDCE0B}'
,0 ,4, 0)
class IE_E
ie.Document will give you the document object.
That's where the Html object library comes in,
it contains the early-binding code for the Document
interface. Then you can hook one of the event classes
for the Document (I see several in the generated file)
using the same methodology as shown for th
Hi
Thanks for the response and for the code.
However, I want to trap events like mouse click on the HTML document
loaded by the web browser control. The code mentioned below provides
events from the web browser control. I need to find out on which
particular HTML tag did the user click for example.
The two you'll need to run makepy for are Microsoft Internet Controls and
Microsoft HTML object Library. If you run them manually, you should be
able to look at the generated code to get the guids.
Here's a minimal example:
import win32com.client
ie_mod=win32com.client.gencache.EnsureModule('{EA
I am trying to trap events from internet explorer eg. when user clicks
on an html link - I need to get notified for that event.
After looking through the newgroups / internet and reading through
various sections in programming python on win32 - I understand that
this can be done using DispatchWith
18 matches
Mail list logo