471,349 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

IEC - cannot find button

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

Oct 29 '07 #1
2 3073
On Oct 29, 12:58 am, daniel_no...@msn.com wrote:
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>
You might want to look at PAMIE instead. It sounds like a Python
project that's aimed at automating Internet Explorer:
http://sourceforge.net/projects/pamie/

But if you really like COM, I found this tutorial:

http://www.evilbitz.com/2006/10/22/p...ough-tutorial/

I'm not very good with COM, but I would recommend that you do some
research on it. From the traceback, I would guess that you don't have
administrator privileges (of some sort) on the machine you're running
the script on.

Mike

Oct 29 '07 #2
On Oct 29, 6:04 am, kyoso...@gmail.com wrote:
On Oct 29, 12:58 am, daniel_no...@msn.com wrote:
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>

You might want to look at PAMIE instead. It sounds like a Python
project that's aimed at automating Internet Explorer:http://sourceforge.net/projects/pamie/

But if you really like COM, I found this tutorial:

http://www.evilbitz.com/2006/10/22/p...-thorough-tuto...

I'm not very good with COM, but I would recommend that you do some
research on it. From the traceback, I would guess that you don't have
administrator privileges (of some sort) on the machine you're running
the script on.

Mike
Thanks for the input, Mike. Since I don't have much experience w/
either, I don't have a strong preference for COM over PAMIE. I'm just
frustrated my script isn't working. I guess it could have to do w/
privileges. I'm using a VPN connection. I tried turning off my
antivirus software before running the module. I can click on the
button I want manually, and get the page I need, so I wonder if I can
adjust some settings to allow Python to take control of certain
things? That or I thought it might have to do w/ a javascript error.
By looking at the tag, does 'PDF Preview' look like the name of the
button or the button caption? Let me know what you think.

Daniel

Oct 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by rossum | last post: by
reply views Thread by bill yeager | last post: by
reply views Thread by Mohammad Ali via DotNetMonster.com | last post: by
reply views Thread by AngelaMDick | last post: by
2 posts views Thread by karinmorena | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.