Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not start Selenium session: You may not start more than one session at a time

this is a configuration error , when trying to configure selenium with eclipse , what i read in a couple of websites is that , adding a dependency to maven would do , but nothing worked , i have been spending a lot of hours/day , even modified the system property , to add firefox profile into it , but nothing worked . looks like i am the first one on this earth to get this error

thankyou

pasting a stack trace , for your reference java.lang.RuntimeException: Could not start Selenium session: You may not start more than one session at a time at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:90) at TestAddVisitor.setUp(TestAddVisitor.java:36) at junit.framework.TestCase.runBare(TestCase.java:132) at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:228) 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:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: com.thoughtworks.selenium.SeleniumException: You may not start more than one session at a time at org.openqa.selenium.WebDriverCommandProcessor.start(WebDriverCommandProcessor.java:217) at org.openqa.selenium.WebDriverCommandProcessor.start(WebDriverCommandProcessor.java:208) at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:82) ... 16 more

like image 343
user801490 Avatar asked Dec 21 '22 12:12

user801490


2 Answers

I guess this is not a configuration error. If my understanding is correct you are are creating WebDriver object and then creating DefaultSelenium / Selenium object with it and then starting the selenium session.

then -- don't use DefaultSelenium.start() method.

Code should be like this:

DefaultSelenium ds = new DefaultSelenium(
        new WebDriverCommandProcessor("baseURL",new FirefoxDriver()));
// ds.start(); -- do not do this
ds.open("/");

This might help you.

like image 165
sudarsan Avatar answered Jun 23 '23 12:06

sudarsan


Did you take a look at http://seleniumhq.org/docs/03_webdriver.html#webdriver-backed-selenium-rc? sudarsan in the previous answer is right: don't do selenium.start.

like image 25
Alberto Avatar answered Jun 23 '23 13:06

Alberto