3lncr's blog

As simple as possible, but not any simpler…

Firefox 3.6, Selenium 1.0.1 with selenium-rc-0.1.1 and “Lock file still present!” issue

with 7 comments

Have you just updated your shiny Firefox to version 3.6 and now you can’t make Selenium 1.0.1 (precisely: selenium-rc-0.1.1) working fine for you on this browser? Ooops… I got the same. 😦

Now, when you try to run one of your Selenium based UI tests on such a brand-new-and-up-to-date “combo” it just fails to start the browser and there is just some annoying exceptions in logs, similar to these:

ERROR - Failed to start new browser session, shutdown browser and clear all session data java.lang.RuntimeException: Firefox refused shutdown while preparing a profile

org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$
FileLockRemainedException: Lock file still present! C:\DOCUME~1\{windows-username}\LOCALS~1\Temp\customProfileDir197b3da3c02244fb8407912c5e126b07\parent.lock

Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: Unable to delete file C:\DOCUME~1\{windows-username}\LOCALS~1\Temp\customProfileDir197b3da3c02244fb8407912c5e126b07\parent.lock

There is a cure. A bit hacky, but still worth to try, if you really need to use Firefox 3.6.

So do some search through your project dependencies JARs and find selenium-server.jar item. Unzip it, find all (of 5) “install.rdf” files inside this JAR (they are under customProfileDirCUSTFF and customProfileDirCUSTFFCHROME subfolders), open them in some text editing tool (they are XML based configuration files) and replace the max version of agent (browser) application from line like this:

<em:maxVersion>3.5.*</em:maxVersion>

into this:

<em:maxVersion>3.6.*</em:maxVersion>

Or just download customized selenium-server.jar (pathed, as above, to Firefox 3.6.*) from this place.

Note: If you are using Grails with Selenium plugin (selenium-rc-0.1.1), you can find selenium-server.jar in your project plugins folder (e.g. {user-home}\.grails\{grails-version}\projects\{project-name}\plugins\selenium-rc-0.1.1\lib\server)

Where:
{user-home} stands for user home folder, e.g. C:\DOCUME~1\johndoe or C:\Users\johndoe
{grails-version} is Grails version, e.g. 1.1
{project-name} is your Grails project name, e.g. test-project

Done. It should work now!

Now go and run some Selenium tests. Happy testing! 🙂

Advertisements

Written by 3lncr

2010-03-04 at 17:28

7 Responses

Subscribe to comments with RSS.

  1. Downloaded customized selenium-server.jar and replaced the old jar with this one. Selenium tests started to work again under FF. Thanks a lot.

    tester

    2010-11-05 at 09:51

    • Hi,

      I tried as per this suggestion, that is I changed the maxVersion to 13.0.*
      because I am using 13.0.1 mozilla firefox but still my issue is not yet resolved, Iam getting the same error.

      Jul 11, 2012 12:16:49 PM org.openqa.grid.selenium.GridLauncher main
      INFO: Launching a standalone server
      16 [main] INFO org.openqa.selenium.server.SeleniumServer – Java: Oracle Corporation 21.0-b17
      16 [main] INFO org.openqa.selenium.server.SeleniumServer – OS: Windows 7 6.1 amd64
      32 [main] INFO org.openqa.selenium.server.SeleniumServer – v2.20.0, with Core v2.20.0. Built from revision 16008
      266 [main] INFO org.openqa.selenium.server.SeleniumServer – RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
      266 [main] INFO org.openqa.jetty.http.HttpServer – Version Jetty/5.1.x
      266 [main] INFO org.openqa.jetty.util.Container – Started HttpContext[/selenium-server/driver,/selenium-server/driver]
      266 [main] INFO org.openqa.jetty.util.Container – Started HttpContext[/selenium-server,/selenium-server]
      266 [main] INFO org.openqa.jetty.util.Container – Started HttpContext[/,/]
      359 [main] INFO org.openqa.jetty.util.Container – Started org.openqa.jetty.jetty.servlet.ServletHandler@2ee784c0
      359 [main] INFO org.openqa.jetty.util.Container – Started HttpContext[/wd,/wd]
      359 [main] INFO org.openqa.jetty.http.SocketListener – Started SocketListener on 0.0.0.0:4444
      359 [main] INFO org.openqa.jetty.util.Container – Started org.openqa.jetty.jetty.Server@58bf7b3e
      12:16:53.891 INFO – Preparing Firefox profile…
      HTML suite exception seen:
      java.lang.RuntimeException: Firefox refused shutdown while preparing a profile
      at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:367)
      at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:120)
      at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launch(FirefoxChromeLauncher.java:90)
      at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchHTMLSuite(FirefoxChromeLauncher.java:405)
      at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchHTMLSuite(FirefoxLauncher.java:110)
      at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:132)
      at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:183)
      at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:617)
      at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:288)
      at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:246)
      at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:54)
      Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException: Lock file still present! C:\Users\SUDHAH~1.SRI\AppData\Local\Temp\customProfileDir13517\parent.l
      ock
      at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:318)
      at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:365)
      … 10 more
      31922 [SeleniumServerShutDownHook] INFO org.openqa.selenium.server.SeleniumServer – Shutting down…
      31922 [Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]] INFO org.openqa.jetty.util.ThreadedServer – Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]
      32031 [SeleniumServerShutDownHook] INFO org.openqa.jetty.http.SocketListener – Stopped SocketListener on 0.0.0.0:4444
      32078 [SeleniumServerShutDownHook] INFO org.openqa.jetty.util.Container – Stopped HttpContext[/selenium-server/driver,/selenium-server/driver]
      32125 [SeleniumServerShutDownHook] INFO org.openqa.jetty.util.Container – Stopped HttpContext[/selenium-server,/selenium-server]
      32156 [SeleniumServerShutDownHook] INFO org.openqa.jetty.util.Container – Stopped HttpContext[/,/]
      32156 [SeleniumServerShutDownHook] INFO org.openqa.jetty.util.Container – Stopped org.openqa.jetty.jetty.servlet.ServletHandler@2ee784c0
      32218 [SeleniumServerShutDownHook] INFO org.openqa.jetty.util.Container – Stopped HttpContext[/wd,/wd]
      32218 [SeleniumServerShutDownHook] INFO org.openqa.jetty.util.Container – Stopped org.openqa.jetty.jetty.Server@58bf7b3e

      Can anyone help?

      Thanks,
      Sudhahar.S

      sudhahar srinivasan

      2012-07-11 at 03:01

  2. Hi there,

    Some time ago it worked as a cool cure. 😛

    Unfortunately, I’m not working on Firefox or web development at the moment. Had to leave all my favourite web stuff for a while. 😛 So can’t help accurate with it. Maybe they changed something in Selenium Server implementation, so it is not that easy to hack it any more. This solution is actually a hack, keep it in mind please.

    What I would suggest? Try to switch back to the latest browser version supported by Selenium. It is probably easier than trying to struggle with hacked version of Selenium Server. 😉

    I’m sorry it doesn’t work for you.

    3lncr

    2012-07-11 at 08:58

  3. It worked for me. Thanks

    Swetal

    2012-10-31 at 16:06

  4. Ok, but… how do you pack the files back into the jar file again? Otherwise, how could you “tell” Selenium server to run the files you modified, and not the original jar instead?

    yaguarete79

    2016-02-09 at 12:44

    • JAR is a Java archive file. Regular archive. Compressed with the ZIP. Any regular archive manager or ZIP command line tool should be enough.
      Altered JAR file is on the classpath, while running Selenium, AFAIR, so all you need to do is to provide it instead of the original one. It is in your projects dependencies. As this is your project, you manage all the dependencies.

      Note:
      THIS IS A HACK, not the solution. I published it as this issue was blocking me while everyday development – Selenium guys always released stuff some time after Firefox releases. AVOID this solution and treat it as a temporary HACK, please.

      PS: I wasn’t using Selenium stuff for some time and I am not an expert in this area anymore for now. This is also based on very old Selenium release (probably also based on it’s very old architecture). I strongly suggest to use newer versions and stick to it’s documentation.

      3lncr

      2016-02-09 at 13:02

      • Thank you so much for the quick response!!! Well, while waiting for this response, I had the idea that jar files where probably zip files, or that I could generate it by zipping the file with WinRar, then raname it to .jar file. I’ve tried it this way, because using the jar command like this “jar cf selenium-server-standalone-2.48.2.jar *” created a jar file that didn’t work. When I tried to run it to load the server, the MS-DOS window closed as fast as it opened. Then I tried just zipping it and renaming it, with the same bad result.
        So I will take your word and consider this just as a hack, and move on searching for further releases from Selenium guys, hopefully some patch or new version solves this problem, as I need to run current FireFox version and Selenium together.
        Regards!

        yaguarete79

        2016-02-09 at 13:30


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: