IEC - cannot find button

Discussion in 'Python' started by daniel_nolan@msn.com, Oct 29, 2007.

  1. Guest

    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>
    , Oct 29, 2007
    #1
    1. Advertising

  2. Guest

    On Oct 29, 12:58 am, 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/python-ie-automation-thorough-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, 2007
    #2
    1. Advertising

  3. daniel Guest

    On Oct 29, 6:04 am, wrote:
    > On Oct 29, 12:58 am, 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/python-ie-automation-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
    daniel, Oct 29, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexei Polkhanov
    Replies:
    11
    Views:
    2,433
  2. Steven T. Hatton
    Replies:
    9
    Views:
    451
    Steven T. Hatton
    Jun 5, 2004
  3. Danny Scaleno

    IEC Controller and <head> element

    Danny Scaleno, Nov 28, 2006, in forum: Python
    Replies:
    1
    Views:
    288
    Danny Scaleno
    Nov 30, 2006
  4. ISO/IEC TR 24731 and Linux

    , Nov 7, 2006, in forum: C Programming
    Replies:
    0
    Views:
    512
  5. Steven T. Hatton

    Hardcopy of ISO/IEC 14882:2003(E) Quality?

    Steven T. Hatton, Jul 8, 2005, in forum: C++
    Replies:
    0
    Views:
    417
    Steven T. Hatton
    Jul 8, 2005
Loading...

Share This Page