Open source Web testing tool - cPAMIE 1.6b released
I am pleased to announce version cPAMIE 1.6 the Web automation tool for Internet explorer. If your looking for a fast way, easy to learn way to drive your browser check out PAMIE. Is PAMIE right for you?, depends on your needs and complexity of the web application. Pamie can take care of the basic needs such as driving web forms without a problem. Been used to test and/or drive Dot Net and Java web applications. can be combined with other opensource tools such as JMeter for performance testing. New Features: * WriteScript method that writes out pamie scripts * Frame Support * Fixes for bugs related to XP sp2 * Get and Set methods for manipulating most controls. For example you can set and/or get the values of textboxes, listboxes, radiobuttons, tables, textarea's, checkboxes etc... * Click methods for buttons, tree objects and links * Fire Event methods * Ability to parameterize data and drive data with add-on DataDriver Class. * Manipulate existing or new Browser windows (not modal dialogs)using find window method. * Use with pythons's PyUnit (unittest) for a complete web testing framework. To Do: * Better Support for modal/non-modal type dialogs * Threading to be addded. Questions - email me: [EMAIL PROTECTED] Enjoy Rob M. -- http://mail.python.org/mailman/listinfo/python-list
Re: New Arrival to Python
I have been using Eclispe IDE with the PyDev plugin for Python Development. it allow you to set up projects. you can use PyAnt to build them. It works great for me. It's free an easy to use. Eclipse is at http://www.eclipse.org There is also Emacs with the python plugin Rob M. python project - http://pamie.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: Using win32com for web automation
ina wrote: Look up pamie it should do all the work you need. If it dosn't I can send you ishyBrowser but pamie has more comunity support. FYI #Imports from win32com.client import Dispatch from time import sleep # Create a new browser object ie = Dispatch('InternetExplorer.Application') # Make the browser visible ie.Visible = 1 # Navigate to the site ie.Navigate(http://ispds-sepsr.prv:7500/cs/welcome.jsp;) # wait for the document to fully load while ie.ReadyState != 4: sleep(1) doc = ie.Document while doc.readyState != complete: sleep(1) # set the textbox value for name to 'some_string' doc.loginForm.name.value = 'username' # set the textbox value for password to 'some_string' doc.loginForm.password.value = 'password' # submit the form doc.loginForm.submit() Added some comments to make it clearer You will now need another wait for the next document you load You can put the wait into a wait method or you could try PAMIE http://pamie.sourceforge.net Hope it helps Rob -- http://mail.python.org/mailman/listinfo/python-list
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 triesattempts: 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: How to receive events (eg. user mouse clicks) from IE
You also want to make sure the frame you want is loaded I use the following method: def _frameWait(self, frameName=None): thisCount = self._timeOut while self._ie.Busy: time.sleep(0.1) thisCount = thisCount - 1 if thisCount == 0: break # wait for user specified Document to load doc = self._ie.Document.frames[frameName].Document # Check results bresult = False thisCount = self._timeOut #reset the timeout counter while doc.ReadyState != 'complete': time.sleep(0.1) thisCount = thisCount - 1 if thisCount == 0: break if doc.ReadyState == 'complete': bresult = True if bresult == True: print Using Frame: ,frameName else: print Loading . . . Roger Upole wrote: Each frame acts as a separate document. You should be able catch document events from a frame using something like win32com.client.DispatchWithEvents(ie.Document.frames(nbr of frame).document, your event class) Roger [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Resurrecting an old thread.. It seems that this solution does not return events on objects within frames in webpages eg . if you go to www.andersondirect.com - the page is composed of three frames called as topFrame main and address. Now when I click on say 'Select a Vehicle' which is within main - I do not get any Onclick event. I also do not get an OnMousemove event if I move the mouse. However, I do get on Mousemove event on a tag called as frameset (which is part of the top page). How does one get events from the frames then? As always thanks a lot. Roger Upole wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ... The problem is that msdn documentation says that in order to identify the element that was clicked - one has to query on IHTMLWindow2::event property on iHTMLWindow2 interface to get IEventOBj interface and then from there - use query interfce to get to the id of the element. How do I do this in python? ie. I have this code class Doc_Events(doc_mod.HTMLDocumentEvents): def Ononclick(self): print 'onClick fired ' and I see onClick being trapped. Now I need to go and get a reference to the iHTMLWindow2 interface. For this I need to get a reference to doc_mod (as far as I can see). How do I get that in the OnonClick method above. To get the IHTMLWindow2, you can just use self.parentWindow inside the event hander, and then get the event from it. And then the event's srcElement should be what you need. class Doc_Events(doc_mod.HTMLDocumentEvents): def Ononclick(self): print 'onclick' ev=self.parentWindow.event src=ev.srcElement print 'tagName:',src.tagName,'name:',src.getAttribute('name') For clicking on google's input field, this yields tagName: INPUT name: q b) You had mentioned PumpWaitingMessages in the previous posting. I first encountered this on newsgroup postings. None of the standard books (python on win32 / python developer) seem to explain this in detail although this seems to be commonly used. Though I understand this now - my problem is that there seems to be a lack of cohesive explanation on how python ties up with COM (despite a good chapter 12 PumpWaitingMessages is just a way to ensure that normal message processing (window messages, events, dde, etc) happens while python code is running. Normally you don't need it, but every once in a while you hit a situation where blocking occurs. For how exactly python interacts with COM, the source is your best bet. Roger == Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News== http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- == Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News== http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- -- http://mail.python.org/mailman/listinfo/python-list
Re: Pressing A Webpage Button
You also may want to fire an event when a button is pressed such as: ie.Document.forms['f'].elements['btnG'].FireEvent('onClick') Events: onclick Fires when the user clicks the left mouse button on the object. onsubmit Fires when a FORM is about to be submitted. For more go here: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp Elliot Temple wrote: How do I make Python press a button on a webpage? I looked at urllib, but I only see how to open a URL with that. I searched google but no luck. For example, google has a button input type=submit value=Google Search name=btnG how would i make a script to press that button? Just for fun, is there any way to do the equivalent of typing into a text field like the google search field before hitting the button? (I don't actually need to do this.) If someone could point me in the right direction it'd be appreciated. -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- 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
OpenSource Automation tool - Pamie 1.5 released
PAMIE 1.50 released!! Now with Frames suport Why wait, when you could be using this to Automate now!... It's Free!!! http://pamie.sourceforge.net What is PAMIE? PAMIE stands for Python Automation module for Internet Explorer. Requirements: * Window 2000, WinNT, WinXP * Python 2.4. (I use Active State Python 2.4.x since it installs the needed win32all library) Optional tools for writing scripts: * Eclipse with pydev plugin ( great for writing, running and debugging scripts) - recommended!! * Emacs - for script writing * Notepad++ - for script writing * PythonWin IDE installed with Activestate Python - http://www.Activestate.org - for script writing and running == This was completely written in Python to be used as a QA/Development tool for Web testing. You will find this is one of the easiest automation tool to use for automating Internet Explorer. PAMIE is a class file (cPAMIE.py) that you import and you can calls its methods to write scripts that automate your IE browser client. Used with PY unit you can write complex Web testing frameworks. Uses: Web testing Use along with Jmeter for Performance testing. == New Enhancements: Frames support improved report status Just a few of the methods available: _frameWait - waits for user specified frame document to load _wait - wait for document to load checkForFormName - check to see if a formname exists in the document checkForFrameName -- check to see if a framename exists ClickBtnImage - Clicks on an input type image button ClickButton - Click on a button ClickImage - clicks on an Image ClickLink - Clicks on a link ClickMenu - Clicks on an menu item,link ClickMenuImage - Clicks on an menu item that is a image. Click a Menu or Sub Menu Item ClickNthImage click on the Nth Image ClickNthLink - click on the Nth link ClickOuterLink - clicks on a link using outertext ClickPageLink - click on the page link GetTextBox - get tectbox value SettextBox - Sets texbox value GetNames - get the names of the form elements GetListbox - gets selected listbox item SetlistBox - sets selected listbox item GetRadioButton - Gets Radio button status SetRadioButton - Sets Radio button GetRadioButtonSet - same as above and much much more !!! Check it out! Thank you R.L. Marchetti -- http://mail.python.org/mailman/listinfo/python-list
Re: Access denied calling FireEvent in Python
Regarding the call to FireEvent: I still do not understand why you could call fireEvent('onchange') and now it you have to call FireEvent('onchange') to avoid the Access denied message In Ruby or Perl you still call fireEvent('onchange') it has not changed and you do not get the access denied error. If anyone has any helpful information regarding this it would be great. Rob [EMAIL PROTECTED] wrote: Found that you have to call FireEvent a different way in the News IE and sp2 Instead of: ie.Document.forms[0].campus.fireEvent('onchange') if needs to be changed to: ie.Document.forms[0].campus.FireEvent('onchange') RLM [EMAIL PROTECTED] wrote: Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an access denied error in Python when called. Here is what I am trying to do: Set the campus listbox value and theb call fire event, such as in the code below. I get an access denied error. example code: ie = DispatchEx('InternetExplorer.Application') # Some code to navigate to the site, wait till doc is not busy and # ReadyState is complete...blah..blah... ie.Document.forms[0].campus.value = '200' ie.Document.forms[0].campus.fireEvent('onchange') HTML code: select style=font-size: 10 name=campus onChange=if (this.options[this.selectedIndex].value != 0) populate(this.options[this.selectedIndex].value) option value=0Select a campus option value=200Norman Campus option value=501Advanced Programs option value=502Liberal Studies option value=504Academic Programs (CAFE) option value=505OU Tulsa/select If you call: fireEvent('onchange') fireEvent('onclick') fireEvent('onFocus') etc... You will get an Access Denied This only happens with either the newer version of IE and XP2. I was able to call the exact same code with XP1 and Win2000 Pro and it work fine. So something has changed with I.E. and is not being handled in Python. example code: ie.Document.forms[0].campus.fireEvent('onchange') Trace: File C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py, line 310, in RunScript exec codeObject in __main__.__dict__ File C:\QA\Tools\cPAMIE150\oCScript2.py, line 24, in ? ie2.Document.forms[0].campus.fireEvent('onchange') File C:\Python23\Lib\site-packages\win32com\client\dynamic.py, line 165, in __call__ return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None) com_error: (-2147024891, 'Access is denied.', None, None) Help would be much appreciated!! RLM -- http://mail.python.org/mailman/listinfo/python-list
Re: Access denied calling FireEvent in Python
Found that you have to call FireEvent a different way in the News IE and sp2 Instead of: ie.Document.forms[0].campus.fireEvent('onchange') if needs to be changed to: ie.Document.forms[0].campus.FireEvent('onchange') RLM [EMAIL PROTECTED] wrote: Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an access denied error in Python when called. Here is what I am trying to do: Set the campus listbox value and theb call fire event, such as in the code below. I get an access denied error. example code: ie = DispatchEx('InternetExplorer.Application') # Some code to navigate to the site, wait till doc is not busy and # ReadyState is complete...blah..blah... ie.Document.forms[0].campus.value = '200' ie.Document.forms[0].campus.fireEvent('onchange') HTML code: select style=font-size: 10 name=campus onChange=if (this.options[this.selectedIndex].value != 0) populate(this.options[this.selectedIndex].value) option value=0Select a campus option value=200Norman Campus option value=501Advanced Programs option value=502Liberal Studies option value=504Academic Programs (CAFE) option value=505OU Tulsa/select If you call: fireEvent('onchange') fireEvent('onclick') fireEvent('onFocus') etc... You will get an Access Denied This only happens with either the newer version of IE and XP2. I was able to call the exact same code with XP1 and Win2000 Pro and it work fine. So something has changed with I.E. and is not being handled in Python. example code: ie.Document.forms[0].campus.fireEvent('onchange') Trace: File C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py, line 310, in RunScript exec codeObject in __main__.__dict__ File C:\QA\Tools\cPAMIE150\oCScript2.py, line 24, in ? ie2.Document.forms[0].campus.fireEvent('onchange') File C:\Python23\Lib\site-packages\win32com\client\dynamic.py, line 165, in __call__ return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None) com_error: (-2147024891, 'Access is denied.', None, None) Help would be much appreciated!! RLM -- http://mail.python.org/mailman/listinfo/python-list
Re: Win 32 - VB, Ruby, Perl VS Python with fireEvent
Roger, Thank you so much! I have been pulling my hair out over this! Rob. Roger Upole wrote: I don't know why case would make a difference, but if I change the fireevent call to FireEvent, it works on XP sp2. It also works if you generate the makepy wrappers (probably because that forces case-sensitivity) hth Roger [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I was wondering if anyone could tell me why fireEvent works in every language but Python with the latest Internet Explorer? I tried this page that has two listboxes if you select Listbox A the Listbox B should change. The code status: Works fine with Python 2.3, 2.4 in Windows XPsp1 DOES not work Python 2.3, 2.4 XP Sp2 or the lastest IE Works fine with RUBY on Win 2000, XP sp1 and XP sp2 Work fine with PERL on on Win 2000, XP sp1 and XP sp2 Luckily I know both Ruby, VB and Perl so I could prove there was a problem. Here is the example code in both Python and Ruby: Python: from win32com.client import DispatchEx import time def wait(ie): while ie.Busy: time.sleep(0.1) doc = ie.Document while doc.ReadyState != 'complete': time.sleep(0.1) ie = DispatchEx('InternetExplorer.Application') ie.Visible = 1 ie.Navigate( 'https://enroll.ou.edu/' ) wait(ie) ie.Document.forms[0].campus.value='200' ie.Document.forms[0].campus.fireevent('onchange') Results: Traceback (most recent call last): File C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py, line 310, in RunScript exec codeObject in __main__.__dict__ File C:\automation\poScript1.py, line 18, in ? ie.Document.forms[0].campus.fireevent('onchange') File C:\Python23\lib\site-packages\win32com\client\dynamic.py, line 154, in __call__ return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None) com_error: (-2147024891, 'Access is denied.', None, None) Ruby: # OU Registration Enrollment Online require 'win32ole' ie = WIN32OLE.new('InternetExplorer.Application') ie.visible = true ie.gohome ie.navigate('https://enroll.ou.edu/') while ie.busy end READYSTATE_COMPLETE = 4 until ie.readyState == READYSTATE_COMPLETE end form = ie.document.forms(0) form.campus.value = '200' form.campus.fireevent('onchange') Results: fireEvent was successful and the second listbox was changed == Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News== http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- -- http://mail.python.org/mailman/listinfo/python-list
Win 32 - VB, Ruby, Perl VS Python with fireEvent
Hello, I was wondering if anyone could tell me why fireEvent works in every language but Python with the latest Internet Explorer? I tried this page that has two listboxes if you select Listbox A the Listbox B should change. The code status: Works fine with Python 2.3, 2.4 in Windows XPsp1 DOES not work Python 2.3, 2.4 XP Sp2 or the lastest IE Works fine with RUBY on Win 2000, XP sp1 and XP sp2 Work fine with PERL on on Win 2000, XP sp1 and XP sp2 Luckily I know both Ruby, VB and Perl so I could prove there was a problem. Here is the example code in both Python and Ruby: Python: from win32com.client import DispatchEx import time def wait(ie): while ie.Busy: time.sleep(0.1) doc = ie.Document while doc.ReadyState != 'complete': time.sleep(0.1) ie = DispatchEx('InternetExplorer.Application') ie.Visible = 1 ie.Navigate( 'https://enroll.ou.edu/' ) wait(ie) ie.Document.forms[0].campus.value='200' ie.Document.forms[0].campus.fireevent('onchange') Results: Traceback (most recent call last): File C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py, line 310, in RunScript exec codeObject in __main__.__dict__ File C:\automation\poScript1.py, line 18, in ? ie.Document.forms[0].campus.fireevent('onchange') File C:\Python23\lib\site-packages\win32com\client\dynamic.py, line 154, in __call__ return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None) com_error: (-2147024891, 'Access is denied.', None, None) Ruby: # OU Registration Enrollment Online require 'win32ole' ie = WIN32OLE.new('InternetExplorer.Application') ie.visible = true ie.gohome ie.navigate('https://enroll.ou.edu/') while ie.busy end READYSTATE_COMPLETE = 4 until ie.readyState == READYSTATE_COMPLETE end form = ie.document.forms(0) form.campus.value = '200' form.campus.fireevent('onchange') Results: fireEvent was successful and the second listbox was changed -- http://mail.python.org/mailman/listinfo/python-list
Access denied calling FireEvent in Python
Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an access denied error in Python when called. Here is what I am trying to do: Set the campus listbox value and theb call fire event, such as in the code below. I get an access denied error. example code: ie = DispatchEx('InternetExplorer.Application') # Some code to navigate to the site, wait till doc is not busy and # ReadyState is complete...blah..blah... ie.Document.forms[0].campus.value = '200' ie.Document.forms[0].campus.fireEvent('onchange') HTML code: select style=font-size: 10 name=campus onChange=if (this.options[this.selectedIndex].value != 0) populate(this.options[this.selectedIndex].value) option value=0Select a campus option value=200Norman Campus option value=501Advanced Programs option value=502Liberal Studies option value=504Academic Programs (CAFE) option value=505OU Tulsa/select If you call: fireEvent('onchange') fireEvent('onclick') fireEvent('onFocus') etc... You will get an Access Denied This only happens with either the newer version of IE and XP2. I was able to call the exact same code with XP1 and Win2000 Pro and it work fine. So something has changed with I.E. and is not being handled in Python. example code: ie.Document.forms[0].campus.fireEvent('onchange') Trace: File C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py, line 310, in RunScript exec codeObject in __main__.__dict__ File C:\QA\Tools\cPAMIE150\oCScript2.py, line 24, in ? ie2.Document.forms[0].campus.fireEvent('onchange') File C:\Python23\Lib\site-packages\win32com\client\dynamic.py, line 165, in __call__ return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None) com_error: (-2147024891, 'Access is denied.', None, None) Help would be much appreciated!! RLM -- http://mail.python.org/mailman/listinfo/python-list