Re: Using PAMIE to upload and download files...is it possible?
If you go into the PAMIE users group and go to the files Section you will see modalPopupTest.py this will handles Uploads, pop-ups, alerts using PAMIE PAMIE will include this feature in the next release http://groups.yahoo.com/group/Pamie_UsersGroup/files/ RLM scrimp wrote: > Well, thanx to Erin I got everything I needed to do to work. > > I basically used 2 classes and wrote a driver using PAMIE > 1 for the two File Download windows and 1 for the Save As window > > Here are the classes I used. I took out the comments, but its really > not too hard to understand > class FileDownloadDialog (threading.Thread): >def __init__(self): > threading.Thread.__init__(self) > self.windowName = "File Download" > self.hwnd = None > >def fetchWindows (self,attempts=20): > tries = 0 > while tries tries = tries + 1 > try: > self.hwnd = winGuiAuto.findTopWindows(self.windowName) > return > except: > print 'Checking for window named "'+ self.windowName + '"', > print 'Attempt #',tries > time.sleep(1) > >def run (self): > self.fetchWindows() > oButton = [] > for hw in self.hwnd: > tButton = winGuiAuto.findControls(hw,"&Save","Button") > if len(tButton) <> 0: > wHwnd = hw > self.hwnd = wHwnd > oButtons = winGuiAuto.findControls(self.hwnd,"&Save","Button") > > time.sleep(0.5) > for oButton in oButtons: > winGuiAuto.clickButton(oButton) > > Heres the 2nd class I used > class SaveAsZipDialog (threading.Thread): > def __init__(self, docPath): > threading.Thread.__init__(self) > self.windowName = "Save As" > self.hwnd = None > self.document = docPath > > def fetchWindow (self,attempts=20): > tries = 0 > while tries < attempts: > tries = tries + 1 > try: > self.hwnd = winGuiAuto.findTopWindow(self.windowName) > return > except: > print 'Checking for window named "'+ self.windowName + > '"', > print 'Attempt ',tries > time.sleep(1) > def run (self): > self.fetchWindow() > fText = winGuiAuto.findControl(self.hwnd, None, "Edit") > winGuiAuto.setEditText(fText,self.document) > oButtons = winGuiAuto.findControls(self.hwnd,"Save") > time.sleep(0.5) > for oButton in oButtons: >winGuiAuto.clickButton(oButton) > > I used PAMIE to get me through the web stuff and when it clicked on the > link to download the zip file I wanted these two classes would kick in > and take over from there. If anyone needs help feel free to email me or > post up on here. Thanks again Erin! > > --Barry -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
Well, thanx to Erin I got everything I needed to do to work. I basically used 2 classes and wrote a driver using PAMIE 1 for the two File Download windows and 1 for the Save As window Here are the classes I used. I took out the comments, but its really not too hard to understand class FileDownloadDialog (threading.Thread): def __init__(self): threading.Thread.__init__(self) self.windowName = "File Download" self.hwnd = None def fetchWindows (self,attempts=20): tries = 0 while tries 0: wHwnd = hw self.hwnd = wHwnd oButtons = winGuiAuto.findControls(self.hwnd,"&Save","Button") time.sleep(0.5) for oButton in oButtons: winGuiAuto.clickButton(oButton) Heres the 2nd class I used class SaveAsZipDialog (threading.Thread): def __init__(self, docPath): threading.Thread.__init__(self) self.windowName = "Save As" self.hwnd = None self.document = docPath def fetchWindow (self,attempts=20): tries = 0 while tries < attempts: tries = tries + 1 try: self.hwnd = winGuiAuto.findTopWindow(self.windowName) return except: print 'Checking for window named "'+ self.windowName + '"', print 'Attempt ',tries time.sleep(1) def run (self): self.fetchWindow() fText = winGuiAuto.findControl(self.hwnd, None, "Edit") winGuiAuto.setEditText(fText,self.document) oButtons = winGuiAuto.findControls(self.hwnd,"Save") time.sleep(0.5) for oButton in oButtons: winGuiAuto.clickButton(oButton) I used PAMIE to get me through the web stuff and when it clicked on the link to download the zip file I wanted these two classes would kick in and take over from there. If anyone needs help feel free to email me or post up on here. Thanks again Erin! --Barry -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
Theres one problem with the code that I saw off the bat. My PAMIE script takes IE all the way up the window thats called "File Download". It has 4 buttons Open, Save, Cancel, More Info. The code u gave to me is for the next window I reach AFTER I click manually on Save. It brings up the Save As window. Anyways, I did the PAMIE part manually and the Save As window was open waiting for the SaveAsDocDialog to click Save. It never did, in fact all it did was freeze up python and crash it. So, im still at a stand still here. I know for sure my PAMIE part of the code works. It gets me to where I need to use winGuiAuto. winGuiAuto just sits there and does nothing for me. The window name "File Download" does NOT work for me. I have no idea where or how to find the className of the window. Again, thanx for all the help. Ill keep on trying it though -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
So here is a class that should do what you want. I don't use pamie we use a in house python ie driver. But it has the same problem. Here is a class that should do what you want. import winGuiAuto import threading class SaveAsDocDialog (threading.Thread): '''Some Internet Explorer dialog windows will halt all other IE functionality until they are populated. This class is used to handle these dialog windows. This little class saves a document to the pc''' def __init__(self, docPath): '''The constructor method.''' threading.Thread.__init__(self) self.windowName = "Save As" self.hwnd = None self.document = docPath def fetchWindow (self,attempts=20): '''Grab the handle of the dialog window''' tries = 0 while trieshttp://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
I dont see the modaltest.py would u please send me a link to it. I still have not been able to gets winGuiAuto to work. I have pamie logging into a site, navigating to the downloads section, and clicking the link of the file to download and it stops right there. I am downloading a zip file and there are two windows that come up. The first one is the File download window in which it asks to either Open, Save, Cancel, or More Info and then after clicking Save it brings up another window Save As and asks where you want the file This is my code: rVal = None dnldpath = "C:\\" dnld = findTopWindow("File Download") btnSave = findControl(dnld, "&Save", "Button") clickButton(btnSave) save = findTopWindow("Save As") btnSave2 = findControl(save, "&Save", "Button") editPath = findControl(save, None, "Edit") if dnldPath != None: setEditText(editPath, dnldPath) rVal = getEditText(editPath) clickButton(btnSave2) and then I just quit IE right after that. Thanks again! -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
This is your code I used...I didnt change anything from it def useSaveASDialog(filePath=None): from watsup.winGuiAuto import findTopWindow,findControl,setEditText from time import sleep rVal = None handle = winGuiAuto.findTopWindow("Save As") sButton = winGuiAuto.findControl(handle,"&Save","Button") sEdit = winGuiAuto.findControl(handle, None, "Edit") if filePath != None: winGuiAuto.setEditText(sEdit, filePath) rVal = winGuiAuto.getEditText(sEdit) winGuiAuto.clickButton(sButton) return rVal So, in the interactive window I make an instantiation of it and this is what I get r = useSaveASDialog("C:\Downloads") Traceback (most recent call last): File "", line 1, in ? File "C:\My Documents\python scripts\mytest1.py", line 6, in useSaveASDialog handle = winGuiAuto.findTopWindow("Save As") File "C:\PYTHON23\lib\site-packages\watsup\winGuiAuto.py", line 158, in findTopWindow raise WinGuiAutoError("No top level window found for wantedText=" + WinGuiAutoError: No top level window found for wantedText='Save As', wantedClass=None, selectionFunction=None, maxWait=1, retryInterval=0.1 So, I fire up IE manually and find a link to click on that brings up the download window and the first window I run into is the File Download window with an Open, Save, Cancel, and More Info buttons. I click on Save and that brings up the Save As window, so from there I go back to PythonIDE and do the same command in the window and it PythonIDE crashes. The weird thing is though it puts the path inside the Filename text box. Just the path without the file. Ill be testing this more next week, so ill get back with you then. Thanks for the start though!! --Barry -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
Yes, you should be able uploads and downloads, but you have to import modaltest which uses WinGuiAuto to do this. This also handles pop-ups ModalTest.py is in the files section of the Pamie Users Group http://pamie.sourceforge.net. You have to sign up as a member to access the file. Membership is free. It uses threading to allow you to upload and download and then continue on with your test. I will be incorporated into PAMIE 1.6 Let me know if you runn into any problems! RL Marchetti scrimp wrote: > Thank you. I will try to come up with something I will post more if I > have any other questions. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
Thank you. I will try to come up with something I will post more if I have any other questions. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
You are opening up the file open dialog when you are trying to do this right? If so you will need to use winguiauto. To find the dialog and the use it to enter the info you want. I included some code that shows how to do this. One other problem you are going to have is that these dialogs are called by ie. pamie uses com to control ie. So the button click will not return antell after you have delt with the dialog box. Best way to deal with this is to span a new thred befoe you click the button to deal with the dialog. def useSaveASDialog(filePath=None): """ This function sets the file path if it is spesified then saves the file to the location listed it will return the file path of the saved file. or None if the file didn't get saved for some reason. """ rVal = None handle = winGuiAuto.findTopWindow("save as") sButton = winGuiAuto.findControl(handle,"&Save","Button") sEdit = winGuiAuto.findControl(handle, None, "Edit") if filePath != None: winGuiAuto.setEditText(sEdit, filePath) rVal = winGuiAuto.getEditText(sEdit) winGuiAuto.clickButton(sButton) return rVal def useChooseFileDialog(filePath=None): """ This function sets the file path if it is spesified then saves the file to the location listed it will return the file path of the saved file. or None if the file didn't get saved for some reason. """ rVal = None sButton = None handle = winGuiAuto.findTopWindow("Choose file") sButton = winGuiAuto.findControls(handle,"&Open","Button") print sButton sEdit = winGuiAuto.findControl(handle, None, "Edit") if filePath != None: winGuiAuto.setEditText(sEdit, filePath) rVal = winGuiAuto.getEditText(sEdit) winGuiAuto.clickButton(sButton[1]) return rVal Hope this was of help to you. Erin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Using PAMIE to upload and download files...is it possible?
As I understand it, newer versions of IE have uploading and downloading via script disabled as a security measure. You might be able to do some low-level API calls to deal with the download window. Roger "scrimp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ive been using PAMIE 1.4 to try to automate web page processes. The one > thing I cannot do with it is upload files and download files. > > With uploading files, the file input box does not allow PAMIE to enter > in a path to a file. > > With downloading files, I can click on the link to download the file, > but thats where I get stuck at. It brings up that download window and > then it brings up the where to save window. > > Theres no errors that I encounter when I get stuck at these spots it > justs sits there not knowing what to do. > > If anyone has had success in both uploading or downloading or even some > insight, I would greatly appreciate your help. Thanks! > == Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News== http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups = East and West-Coast Server Farms - Total Privacy via Encryption = -- http://mail.python.org/mailman/listinfo/python-list
Using PAMIE to upload and download files...is it possible?
Ive been using PAMIE 1.4 to try to automate web page processes. The one thing I cannot do with it is upload files and download files. With uploading files, the file input box does not allow PAMIE to enter in a path to a file. With downloading files, I can click on the link to download the file, but thats where I get stuck at. It brings up that download window and then it brings up the where to save window. Theres no errors that I encounter when I get stuck at these spots it justs sits there not knowing what to do. If anyone has had success in both uploading or downloading or even some insight, I would greatly appreciate your help. Thanks! -- http://mail.python.org/mailman/listinfo/python-list