开发者

Could not start Selenium session: Failed to start new browser session: Error while launching browser

开发者 https://www.devze.com 2023-01-08 05:33 出处:网络
I initialize the selenium like public void setUp() throws Exception { setUp(\"http://localhost/\", \"*firefox\");

I initialize the selenium like


public void setUp() throws Exception 
    {
     setUp("http://localhost/", "*firefox");
    }

and I write my test in the method like


public void testUntitled() throws Exception
{   
    boo();
    foo();
}

But it gives error like

 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:89) 
at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:123)
at com.thoughtworks.selenium.SeleneseTestBase.setUp(SeleneseTestBase.java:104) 
at com.thoughtworks.selenium.SeleneseTestCase.setUp(SeleneseTestCase.java:78)
at ComserTest_v2.setUp(ComserTest_v2.java:12) 
at junit.framework.TestCase.runBare(TestCase.java:132)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) 
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start     
new browser session: Error while launching browser 
at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97) 
at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262) 
at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:开发者_StackOverflow社区223) 
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:81)...19 more

I could not find a solution myself and in google results. Any help will be appreciated.

Thanks anyway.


Firefox only allows one instance of each profile. If you did not conigure anything for it and your firefox browser is open when starting the test. Firefox blocks selenium from using it.

Configure a profile in Firefox and you can configure selenium to use a ff profile

when you run Selenium Server, run with the server with command-line option -firefoxProfileTemplate "path to the profile"

(in case you didn't configured that)

Configuring profiles in FF


I keep having the same issue and have fixed it each time by updating my version of Selenium server to the latest version. It seems that every time Firefox releases a new update it stops old versions of Selenium server from working!

0

精彩评论

暂无评论...
验证码 换一张
取 消