[python-win32] Failure in calling ie.document.body.getElementsByTagName('div')

Johannes Frank jmfrank63 at gmail.com
Sun Mar 8 04:46:57 CET 2015


Hello Mark, hello everyone,

I just wanted to report that the following error occurs:

Traceback (most recent call last):
  File
"C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 326, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\Users\jmfra_000\Documents\Python Scripts\IEControl.py", line 11,
in <module>
    divs = ie.Document.body.GetElementsByTagName('div')
  File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line
192, in __call__
    return
self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None)
com_error: (-2147352319, 'OLE error 0x80020101', None, None)

Here is my script:

import win32com.client

sh = win32com.client.Dispatch('Shell.Application')

windows = sh.Windows()

for window in windows:
    if 'iexplore' in window.FullName.lower():
        ie = window

divs = ie.Document.body.GetElementsByTagName('div')

There is no hurry to fix this (if at all) because it can be easily avoided
by calling:

divs = ie.Document.body.all.tags('div')

Calling the same in IronPython works both ways. I just thought you might be
interested.

Thank you for your attention

Cheers Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20150308/4b10ae0c/attachment-0001.html>


More information about the python-win32 mailing list