2

Followed this post - https://stackoverflow.com/questions/1414934/selenium-could-not-start-selenium-session-failed-to-start-new-browser-session

Error comes up at selenium.start(). I am using Selenium RC (2.16), junit(4.5) in Eclipse IDE.

The only way to overcome this issue is to redeploy our framework in Tomcat server, just restart everything.

This is the piece of code that starts Selenium:

private static HttpCommandProcessor proc;
 public static DefaultSelenium selenium;
 if (selenium == null) {
 proc = new HttpCommandProcessor("localhost", 4444, browserName,
 urlName);
 selenium = new DefaultSelenium(proc);
 **selenium.start();**
 selenium.setTimeout(String.valueOf(PAGE_TIMEOUT_TIME));
 selenium.useXpathLibrary("javascript-xpath");
 selenium.deleteAllVisibleCookies(); 
 }

The Selenium Server is already started when the execution reaches the above code.

Below is the exception that comes up when execute the tests:

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Error while launching browser
 at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:107)
 at <package>.SuperClass.connectToUrl(SuperClass.java:340)

Any help or clue to resolve this thing would be appreciated!

asked Jul 17, 2012 at 14:16
3
  • 1
    Did you run netstat -an | find "4444" to see if selenium server was already running? It sounds like if that's the case you would have to kill the selenium server process and to avoid this in the future, you would want to make sure you are always calling selenium.stop() in your cleanup. Commented Jul 17, 2012 at 20:42
  • I have not done a netstat but do call the url -localhost:4444/selenium-server/driver/… from the browser, to see incase the server is up, will shut it down. And yes, selenium.stop() is always called in the after class method. Commented Jul 18, 2012 at 4:46
  • 1
    Can you provide entire stack trace? It might contain another useful message in the middle line. Commented Jan 11, 2013 at 2:13

1 Answer 1

2

It is possible you are running an incompatible version of Firefox with your Selenium version. As mentioned in another question you asked, Selenium RC 2.16 is only compatible up to Firefox 11. After that, you need webdriver. Here is a link to that question:

Firefox browser launches blank page while running tests via Selenium

answered Dec 11, 2012 at 14:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.