views:

555

answers:

2

I am testing in selenium and I have a bunch of stuff that happens on page load. I found out about autoit, and I was thinking that it could handle all javascript dialog issues. I was searching around the web for some autoit script that could handle this...

Other options would be helpful as well!

I don't necessarily need all the code, but some point in the right direction would be helpful.

A: 

If you are having issues with alert boxes you might want to disable them programmatically or create a separate mode in your code that would turn them off based on a condition (i.e. debug mode).

Macro recording programs don't work as well as you might think. Typically macro-recording programs record locations of mouse clicks and timing of key presses. The better macro-recording programs use (typically image processing) and (rarely) computer vision techniques. The solutions that use these techniques are typically VERY EXPENSIVE. (5k-10k per seat) [I can't remember one of the names of the better versions Might be QuickTest, but it was made by a company that was bought out by HP]

monksy
well its not simply about ignoring it the dialog... it needs to always select ok. Perhaps I could set up a pluggin in firefox that always confirms, but alerts and confirmations are based on the OS not on the browser, I believe.
Parris
+2  A: 

Alright so this solution works for me... I was able to close 2 windows here. Also I will be able to handle popups based on their name which is cool. It always runs in the background after I have lauched the script. When I want it to end I simply close autoit from task manager or from the task bar area on the right.

While True
If WinWait('Name of your Popup', '', 1) == 1 Then
 ;Wait for page to load if found
 Sleep(10000)
 ;Close Page
 Send('!{F4}') 
 Sleep(5000)
 ;Confirm Dialog
 Send('{ENTER}') 
 Sleep(1000)
 ;Close Lanucher Page
 Send('!{F4}') 
 Sleep(5000)
 ;Confirm Dialog
 Send('{ENTER}') 
EndIf
;Let another thread have a turn
sleep(3)
WEnd

Also this is possible from directly within python, details: http://www.parrisstudios.com/?p=308, but you still need autoit3.

Parris