Tuesday, October 14, 2008

Use Selenium RC in Firefox 3

How to use Selenium RC in Firefox 3

For a while now i have been told that selenium RC does not work in firefox 3. This is a huge bummer for anyone who wants to run functional tests and has to downgrade to firefox 2.

Edit 1/12/2009:
A new version (1.0 beta 2) of selenium RC was released today that fixes this issue once and for all!
get it here. You shouldnt need to do this hack now, unless you want to use the old non-beta version. If you do need to use the old version of selenium, here is how to get it to run firefox 3:

Edit 2/8/2009:
Today i was told that there is a firefox extension that allows you to turn of extension version checking. Also, you can do it by editing about:config.

Today i found a workaround to this problem, which works, and is really simple.

Here is what you need to do:
1. Open selenium-server.jar using winrar
2. locate 2 dirs: customProfileDirCUSTFFCHROME and customProfileDirCUSTFF
3. recursively explore each of those dirs, and when you find a file called install.rdf drag it to some temp location, and edit the following line:
change it to:
4. drag the install.rdf back into the archive and overwrite the old one.
5. do this for all the install.rdf files in those 2 dirs.

you can now use "*firefox" in selenium RC. "*chrome" was giving me problems though, complaining about a malformed rdf file, i might have made a mistake in one of them. Either way, i use *firefox, so it does not matter to me.

if you want, you can get my modified selenium jar here - modified to run in firefox3.
the version of selenium that this jar contains are:

also, there is a 1.0-beta1 compatible modified jar here

Edit 12/10/2008:
Some people have been asking for help with selenium errors in the comments. I cannot help you with those, they are probably specific to what you are doing. If you have question about selenium RC errors, you should try asking them on the Selenium RC User Forums.

Monday, October 13, 2008

IE beeps on enter in an input

I have an input box where the onKeyDown event will check if the key pressed was enter, and submit the form on enter. This works fine, but in IE 7 the browser beeps when you press enter, and submits the form.

This happens because 'enter' is not valid within the context of an input box, according to IE. Thus, pressing it will cause the beep. What you need to do to remove the beep, is to return false from the function which does the submit. It looks something like this:

<input onkeydown="return postOnEnter(event)"/>

obviously, i am calling some custom functions in the snippet above, but the location of the return statements, and their values is all that matters.

Wednesday, October 01, 2008

jQuery: constrain input chars plugin

you need to only allow the user to input certain characters into the input box, and you want a jquery plugin to do it!


the following lets you specify which chars (regexes or'ed together) are allowed in the input.

i added a small demo for the plugin, check it out here

get the plugin here