August 3, 2008

Nasty bug in selenium

On Friday I came across a nasty bug in selenium (but I still like it).

Selenium wouldn't start

The build was failing - and the reason was the last thing I expected (of course). The usually reliable selenium server just wouldn't start. Looking at the stack trace, then searching for likely looking parts of it (btw, for the search I tried, google, yahoo and altavista find the answer, but msn, cuil and askjeeves don't. Just thought I'd try them out because of the launch of cuil).

I found the answer (I think you can turn the popup blocker back on again too - I think the problem is because the registry entry is missing rather than because of its value).

The stack trace is like this (in case you are searching too):

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at org.openqa.selenium.server.browserlaunchers.WindowsUtils$RegKeyValue.<init>(WindowsUtils.java:622)
at org.openqa.selenium.server.browserlaunchers.WindowsUtils.deleteRegistryValue(WindowsUtils.java:577)
at org.openqa.selenium.server.browserlaunchers.WindowsProxyManager.handleEvilPopupMgrBackup(WindowsProxyManager.java:106)
at org.openqa.selenium.server.browserlaunchers.WindowsProxyManager.init(WindowsProxyManager.java:81)
at org.openqa.selenium.server.browserlaunchers.WindowsProxyManager.<init>(WindowsProxyManager.java:65)
at org.openqa.selenium.server.browserlaunchers.InternetExplorerCustomProxyLauncher.<init>(InternetExplorerCustomProxyLauncher.java:48)
at org.openqa.selenium.server.browserlaunchers.InternetExplorerCustomProxyLauncher.<init>(InternetExplorerCustomProxyLauncher.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.createBrowserLauncher(BrowserLauncherFactory.java:124)
at org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory.getBrowserLauncher(BrowserLauncherFactory.java:81)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:87)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:141)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:1138)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:386)

Now that wasn't so difficult was it?

The problem was caused by something I didn't do (but rather by some remote machine update thingie) which made it difficult, and the error message didn't give much of a clue (although looking at it carefully it does look like the registry value for the EvilPopupMgr can't be deleted because it doesn't currently exist).

Having fixed the problem the CI build still won't work

Having thought I'd fixed the problem - I fix up the CI build farm but the build still fails. Running the build manually on the CI farm machines is fine - running through the CI server isn't. The problem is that the CI server doesn't run the build as me - doh - so the "HKEY_CURRENT_USER" I've just fixed isn't the right one!

Time for a cup of tea

From the searches I've done it looks like I'm not the only person who has come across this problem - I hope by writing it up it'll save someone a bit of time. What would save even more time would be if the bug gets fixed - there is a suitable looking issue open for this.

Posted by ivan at 9:55 AM Copyright (c) 2004-2008 Ivan Moore | Comments (0)