My blog has moved!
You should be automatically redirected in 5 seconds. If not, visit http://samueladesoga.wordpress.com and update your bookmarks.

Friday, 4 September 2009

Selenium Remote cant start firefox session due to lock on file

I am sure you have on this page, because you have run into problem with selenium not been able to run due to a lock on some profile files. Yes, you know what the error is. I really found useful two blogs here and here. However, inas much as i don not want to repeat what has been saidin the blogs i would paste and quote what i found useful and explain a little bit more.

Preparing Firefox profile...

The source of the problem is in the *.rdf files inside the selenium server jar. The Selenium guys have hardcoded a version ceiling for Firefox at version 2.0.0.* (in my case it was 3.5.*). The fix is really simple.

Step 1: Extract the files needing change (from the directory where you have the jar). -

jar xf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/readystate@openqa.org/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/\{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4\}/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFF/extensions/
readystate\@openqa.org/install.rdf
jar xf selenium-server.jar customProfileDirCUSTFF/extensions/
\{538F0036-F358-4f84-A764-89FB437166B4\}/install.rdf

Step 2: Change the max version in the rdf (Resource Description Framework) files.

The line of interest looks like this: 2.0.0.*

* you can change this to 4.*, should buy some time.

Step 3: Update the jar with your changes.

jar uf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/readystate@openqa.org/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFFCHROME/
extensions/\{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4\}/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFF/
extensions/readystate\@openqa.org/install.rdf
jar uf selenium-server.jar customProfileDirCUSTFF/
extensions/\{538F0036-F358-4f84-A764-89FB437166B4\}/install.rdf

That's it, once that's changed you should be good to go for testing against Firefox 3!

So that was a summary of what i found, but my case was a bit different as the version of firefox that was hardcoded in the selenium-server 1.0.1 was 3.5.* and my version of firefox was 3.5.2, so naturally i expected firefox to work for me. But as it did not work, as a trail and error, i changed the hardcoded version to 4.5.*. and voila it worked for me.

Also i did not use the jar uf command, what i did was to temporarily change the extension of the selenium server jar file to a .zip file and then i opened the zipped file created with winzip.

I then extracted the 5files which i need to amended to my desktop, amended the file with a text utility and then drop the files back into the zippped selenium server file. Lastly i changed the extensions back to .jar.

And it worked. i hope this works for someone as well

3 comments:

Raffi said...
This comment has been removed by the author.
Mikhail Koryak said...

i am glad you found my post useful =)

Anonymous said...

Thank You. This ended hours of pain.