[IronPython] Problems in Automating IE with IronPython

Ray Djajadinata rayfd_2000 at yahoo.com
Thu Sep 22 10:11:07 CEST 2005


I need to automate IE, but I'm not very familiar with
the object model yet, so I want to try out things
interactively--hence Python. I can do this using win32
extension for CPython, but there's no auto completion,
everything is just a "<COMObject <unknown>>". 

So I thought, hey, IP has auto completion, and I can
tlbimp shdocvw.dll, so I can get the best of both
worlds. I did exactly that:

TlbImp.exe C:\WINDOWS\system32\shdocvw.dll
/out:IEDotNet /namespace:IEDotNet

and then in IP console:

>>> import sys
>>> sys.LoadAssemblyFromFile("IEDotNet.dll")
>>> from IEDotNet import *
>>> ie = InternetExplorerClass()
>>> ieApp = ie.Application
>>> ieApp.Visible = 1
>>> ieApp.Navigate("http://www.yahoo.com/")
(<System.Reflection.Missing object at 0x003E799B>,
<System.Reflection.Missing ob
ject at 0x003E799B>, <System.Reflection.Missing object
at 0x003E799B>, <System.R
eflection.Missing object at 0x003E799B>)
>>> doc = ieApp.Document

After ieApp.Document, IP hangs there, and I couldn't
do anything but to Ctrl+C it. Has anybody ever
experienced this before?


Yahoo! Mail - PC Magazine Editors' Choice 2005 

More information about the Ironpython-users mailing list