By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,715 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,715 IT Pros & Developers. It's quick & easy.

Python - Pamie "onclick" how to handle

P: 4
Newbie needs detailed help on an issue involving the use of a popup (Java) window. Simply I need to fire / activate the "OK" portion of the window.

I'm using Pamie to generate automated testing and so far everyting has gone well until I ran across a pop up window.

My test script in part is as follows:
Expand|Select|Wrap|Line Numbers
  1. #Navigate to Remove account
  2. ie.navigate(url + '/profile/RemoveAccount.aspx?Inst=Institution%20Auto%20Test&Company=Company%20Auto%20Test&Site=Site%20Auto%20Test')
  3. time.sleep(2)
  4. #Select "Company 2" for deletion
  5. ie.buttonClick('GID_852963742')
  6. time.sleep(2)
  7. #Delete Profile    
  8. ie.buttonClick('_ctl0_ContentPlaceHolder1_RemoveAccount1_btnDelete')  
  9. time.sleep(2)
At this point the pop up window is displayed. In the view source window of I.E. the following is found:

<input type="submit" name="_ctl0:ContentPlaceHolder1:RemoveAccount1:btn Delete" value="Delete" onclick="return confirm('Are you sure you want to delete the selected accounts?');" language="javascript" id="_ctl0_ContentPlaceHolder1_RemoveAccount1_btnDe lete" />

The pop up box displays an "OK" and a "Cancel" button. I wish to "fire" the "OK".

Can some one please provide details / hand hold how to handle this? I've read about thirty post on various boards, many taking far different approaches. Some examples given have 30-40 lines of code just to activate the "OK" button and I'm not schooled enough in Python / PAMIE to understand what the sample code is doing.

The help is appreciated.
May 12 '09 #1
Share this Question
Share on Google+
5 Replies


P: 4
Anybody? Hello? ???
May 12 '09 #2

P: 4
Can no one assist with this issue? geeez, come on guy/gals....
May 27 '09 #3

YarrOfDoom
Expert 100+
P: 1,247
Frankrentef, please understand that this forum consists of people who do this voluntarily, and thus that there isn't always a person here who knows the solution to the problems posted.

Now, correct me if I'm wrong, but PAMIE seems a bit underpowered for this, so you might have to take a look at some other way to do this.
May 27 '09 #4

P: 25
Read up on and try WinGuiAuto. It should help you get an instance of the popup window and "click" the ok button. brief example of clicking the "Save" button on "File Download" pop-up....

Expand|Select|Wrap|Line Numbers
  1. hwnd = wga.findTopWindow(wantedText='File Download')
  2. saveButton = wga.findControl(hwnd, wantedText="Save",wantedClass="Button")
  3. wga.clickButton(saveButton)
Hope this helped.....
Jul 10 '09 #5

P: 1
@Silgd1
Hi Silgd1,

You're a lifesaver. I went through hours and hours searching for how to click on a javascript alert(), and this solved it in less than five minutes.

Thank you!
Jul 25 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.