This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
21 lines (12 loc) · 1.58 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Thanks a million to Olle Jonsson (http://github.com/olleolleolle) for adding in all of the Firefox preference additions.
My blog post on this issue: http://distributed-frostbite.blogspot.com/2010/02/closing-javascript-alerts-in-selenium.html
This is a simple Firefox extension that I use to close unexpected alert boxes while running Selenium tests. Prior to this the alerts where out of context and Selenium could not control them. You can see the Selenium-RC FAQ for more information:
http://wiki.openqa.org/display/SRC/Selenium+RC+FAQ
While watching Jason Huggins' presentation on Hacking Selenium ( http://www.infoq.com/presentations/huggins-hacking-selenium ), he demonstrated a way to close the alerts at the browser layer (XUL). This method was sent to him by Aaron Boodman of Greasemonkey fame. I (Dan Wanek) have taken the base of Aaron's code and turned it into a simple Firefox extension. It has worked for me in all of the instances that I have needed it, but if you are having issues you may need to tweak the alertCloser.alertClose method to make it more general use.
There is a preference you can set: extensions.alert_closer.millisbeforeclose which defaults to 1000.
Enjoy!
To create the XPI for installation into Firefox simply change to the "FirefoxAlertCloser" directory and zip up the contents. For example:
git clone git://github.com/zenchild/FirefoxAlertCloser.git
cd FirefoxAlertCloser
zip -r ../alert_closer.xpi . -x ".git/*"
Now just go into Firefox and open the xpi file you created. I would recommend doing this in a special Firefox profile for Selenium testing.