Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

A Firefox Extension that automatically closes alerts. Its intention is to aid in running Selenium scripts.

License

Notifications You must be signed in to change notification settings

zenchild/FirefoxAlertCloser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A Firefox Extension that automatically closes alerts. Its intention is to aid in running Selenium scripts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published