wood burning stoves 2.0
The moose likes Testing and the fly likes Selenium Testing Firefox Launch Failing - Failed to start new browser session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Selenium Testing Firefox Launch Failing - Failed to start new browser session" Watch "Selenium Testing Firefox Launch Failing - Failed to start new browser session" New topic

Selenium Testing Firefox Launch Failing - Failed to start new browser session

Sachin Joshi
Ranch Hand

Joined: Aug 06, 2008
Posts: 83

I am trying to run selenium test cases on my site from windows machine and getting a wierd firefox launching problem from past few days.

I have tried few options per selenium FAQ page, however the problem still persists.
I have tried following things

1. I have tried cleaning up the C:\DOCUME~1\fromdev\LOCALS~1\Temp directory. The directory mentioned in the java stacktrace does not really exist on my system.
2. I have also tried restarting my system, just avoid any existing processes causing this.
3. I have also tried checking the task manager on my windows machine and I dont see any firefox processes.
4. I have also tried removing existing firefox profiles and recreating them.
5. I have also tried firefox with no-addon mode, however no difference.

The exception stacktrace is as shown below.

12:06:54.218 INFO - creating new remote session
12:06:54.218 INFO - Allocated session 6461092698d344f0b9856f9152024b63 for http://www.fromdev.com, launching...
12:06:54.234 INFO - Preparing Firefox profile...
12:07:15.238 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: Firefox refused shutdown while preparing a profile
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.wai
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.pop
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.lau
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.lau
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRem
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSessi
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowse
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(Se
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleComman
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(Selen
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)

at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:9
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher$FileLockRemainedException: Lock file still present! C:\DOCUME~1\fromdev\LOCALS~1\Temp\customProfileDir6461092698d344f0b9856f9152024b63\parent.lock
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.wai
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.wai
... 20 more
12:07:15.238 INFO - Got result: Failed to start new browser session: Error while
launching browser on session null

Any help or suggestions are welcome, I am running out of ideas to fix this problem.

Web Development Tips and Tutorials - By Sachin
Priyanka Dandekar
Ranch Hand

Joined: Aug 06, 2008
Posts: 52
How about trying a re-install of firefox?

Priya - Mockup Tool | Java | Struts2 | Lucene
Sachin Joshi
Ranch Hand

Joined: Aug 06, 2008
Posts: 83

Tried it, doesn't work either. I am now using googlechrome instead.
Ray Rudd

Joined: Jun 12, 2012
Posts: 2
I am seeing the same issue. Firefox used to work fine until I upgraded to 13.0. The the Integrated Developer Environment works fine but when I export to Java it will not start the browser session now. All my previous tests have the same problem now - so I've got to find some fix to this. Could sure use some help.

Thank you
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
You might try the hack described here. It's been a while since I used Selenium, but according to this blog it seems that having a higher version of FF than the maxVersion declared in the XML causes problems.
Ray Rudd

Joined: Jun 12, 2012
Posts: 2
Thank you Dennis. I haven't tried that but is sounds like a good resolution. It helps me understand why 12 works and 13 does not and how to handle it in the future. I went back to FF 12.0 and everything works well. FF has gotten a little aggressive on their releases. We were afraid something like this might happen because of that. So I've parked on FF 12.0 now (turned off auto updates - actually had to update some files - here is a link if others are interested (http://support.mozilla.org/en-US/questions/839764 ) and I'll evaluate FF releases and Selenium updates in combination now - before letting it get into our test harness.
Thanks Ray
I agree. Here's the link: http://aspose.com/file-tools
subject: Selenium Testing Firefox Launch Failing - Failed to start new browser session
It's not a secret anymore!