IEC - cannot find button

daniel_nolan at msn.com daniel_nolan at msn.com
Mon Oct 29 01:58:55 EDT 2007


I'm brand new to Python--and programming in general. I'm trying to use
IEC to control Internet Explorer. I've navigated to a page, and now
I'm trying to click a button. The button appears to be called 'PDF
Preview' but I honestly do not know whether that's the name or the
caption. Here is my code:

     from win32com.client import Dispatch
     import IEC

     .
     .
     .


     ie = IEC.IEController(window_num = 1)
     ie.Navigate(URL_part_1 + x + URL_part_2)
     ie.ClickButton(name='PDF Preview')

(I've also tried replacing name w/ caption but I get a similar error
message.) I get this error message:

Traceback (most recent call last):
  File "C:\Program Files\Python25\experiment", line 14, in <module>
    ie.ClickButton(name='PDF Preview')
  File "C:\Program Files\Python25\lib\IEC.py", line 126, in
ClickButton
    elem = elemcoll.item(i)
  File "<COMObject <unknown>>", line 3, in item
com_error: (-2147024891, 'Access is denied.', None, None)

I really have no idea how to interpret this. I'm pasting the button
tag below:

<td>
     <input type="button" value="PDF Preview"
onclick="javascript:performPdfPreview(2);"/>
</td>




More information about the Python-list mailing list