Selenium Broken by Firefox Upgrade on Ubuntu
Posted on 06/22/2009
I use Webrat and Selenium to automate browser testing. There can be an problem with Firefox 3 on Ubuntu that requires configuring Selenium to point the Firefox binary directly.
Webrat.configure do |config|
config.mode = :selenium
config.selenium_browser_key = '*firefox3 /usr/lib/firefox-3.0.10/firefox'
end
The problem is when Firefox is upgraded the path to the binary will change. That causes an error at the beginning of the test run.
16:10:07.104 WARN - POST /selenium-server/driver/ HTTP/1.1 java.lang.RuntimeException: java.lang.NullPointerException at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(BrowserLauncherFactory.java:145) at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(BrowserLauncherFactory.java:85) at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:318) at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:118) at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:81) at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:658) at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:392) at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:368) at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:129) at org.mortbay.http.HttpContext.handle(HttpContext.java:1530) at org.mortbay.http.HttpContext.handle(HttpContext.java:1482) at org.mortbay.http.HttpServer.service(HttpServer.java:909) at org.mortbay.http.HttpConnection.service(HttpConnection.java:816) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982) at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244) at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534) Caused by: java.lang.NullPointerException at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.<init>(FirefoxChromeLauncher.java:62) at org.openqa.selenium.server.browserlaunchers.Firefox3Launcher.<init>(Firefox3Launcher.java:30) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(BrowserLauncherFactory.java:137) ... 17 more
Then each test will fail with a Selenium::CommandError: Selenium::CommandError. The fix is simple, just update the path to the Firefox binary. Hopefully this will save someone some time.
blog comments powered by Disqus