Unable to handle File Open dialog (using Pamie)

Discussion in 'Python' started by Oltmans, Mar 12, 2008.

  1. Oltmans

    Oltmans Guest

    Hi all,

    I'm new to Python and am automating few tasks using Pamie. Everything
    worked well until I had to handle the File Open Dialog. I mean I'm
    trying to automate the file upload process using Pamie. Basically I
    just want to automate the process of file upload. I want to
    automatically hit the Browse button and then enter 'C:\image1.jpg' in
    the File Name text field and then hit the Open button (all using
    Pamie, winguiauto or whatever would give me the solution :)

    Here is my html ( file is stored in my PC at C:\\Test\Test.html )
    <html>
    <body>

    <input type='file' id='upload'/>
    </body>
    </html>

    and here is my source

    ie.navigate("C:\Test\Test.html")
    ie.buttonClick('upload')
    handle = winGuiAuto.findTopWindow(wantedText="Choose file")
    print 'handle ='+ str(handle)

    p=handlePopup('ChooseFile','&Open')
    p.enterTextAndClickControl(handle,('C:\image1.jpg','&Open'))
    p.run()

    now when I run the above program the Browse button gets clicked and
    File Open dialog pops up but 'c:\image1.jpg' (without quotes) is not
    entered in the File Name field and neither the Open button gets
    clicked. Also I get this error in the console
    --
    Traceback (most recent call last):
    File "firsttest.py", line 26, in <module>
    p.enterTextAndClickControl(handle,('C:\image1.jpg','&Open'))
    File "C:\Python25\lib\site-packages\cModalPopUp.py", line 113, in
    enterTextAn
    ClickControl
    wantedClass="Edit")
    File "C:\Python25\lib\site-packages\winGuiAuto.py", line 167, in
    findControl
    selectionFunction=selectionFunction)
    File "C:\Python25\lib\site-packages\winGuiAuto.py", line 235, in
    findControls
    return searchChildWindows(topHwnd)
    File "C:\Python25\lib\site-packages\winGuiAuto.py", line 213, in
    searchChildW
    ndows
    childWindows)
    TypeError: an integer is required

    --
    I've searched Internet, searched usenet, scratched my head but nothing
    worked. Also, I tried joining the Pamie User group but I couldn't. So
    I will really appreciate your help/insights/ideas/hints/anythiing that
    can help me fix the problem.

    Thanks,
    Rolf
    Oltmans, Mar 12, 2008
    #1
    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. Dietrich
    Replies:
    1
    Views:
    623
    Joe Smith
    Jul 22, 2004
  2. scrimp
    Replies:
    10
    Views:
    1,817
  3. chandan
    Replies:
    0
    Views:
    957
    chandan
    Nov 17, 2008
  4. chandan
    Replies:
    0
    Views:
    503
    chandan
    Nov 17, 2008
  5. eddie wang
    Replies:
    0
    Views:
    390
    eddie wang
    Oct 3, 2003
Loading...

Share This Page