Unable to handle File Open dialog (using Pamie)

Oltmans rolf.oltmans at gmail.com
Wed Mar 12 12:17:45 EDT 2008


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



More information about the Python-list mailing list