Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Followed this post - http://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!

share|improve this question
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. –  Sam Woods Jul 17 '12 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. –  Tahir Shabbir Jul 18 '12 at 4:46
1  
Can you provide entire stack trace? It might contain another useful message in the middle line. –  Misha Akovantsev Jan 11 '13 at 2:13

1 Answer 1

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 when the tests via Selenium

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.