[python-win32] How can I get the parentWindow.document object?

G

goodol

hello everybody

i am trying to automatie IE using python, and i want to access at the
parentWindow.document object

the code is like this,

import win32com.client
import pythoncom
ie = win32com.client.Dispatch("InternetExplorer.Application")
doc=ie.Document.parentWindow.document

the code always failed. the error message is "pywintypes.com_error:
(-2147352567, ...."

How can i get the parentWindow.document object? what' the reason the
code failed?

Thanks in advance.
 
M

MC

Hi!
ie = win32com.client.Dispatch("InternetExplorer.Application")
doc=ie.Document.parentWindow.document

Use bridge variable :
window=ie.Document.parentWindow
And work with :
print window.Document.body.name
 
M

MC

Re!

Sorry! The good exemple is :

ie = win32com.client.Dispatch("InternetExplorer.Application")
window=ie.Document.parentWindow
print window.name

another :
window.alert("Aalleerrtt")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,250
Latest member
Charlesreero

Latest Threads

Top