无法启动 Selenium 会话:您一次不能启动多个会话
这是一个配置错误,当尝试使用 Eclipse 配置 selenium 时,我在几个网站上读到的是,添加对 Maven 的依赖项就可以了,但没有任何效果,我每天花费大量时间,甚至进行修改系统属性,将 firefox 配置文件添加到其中,但没有任何效果。看起来我是地球上第一个遇到此错误的人,
谢谢您
粘贴堆栈跟踪,供您参考 java.lang.RuntimeException:无法启动 Selenium 会话:您不能一次启动多个会话 在 com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:90) 在 TestAddVisitor.setUp(TestAddVisitor.java:36) 在 junit.framework.TestCase.runBare(TestCase.java:132) 在 com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:228) 在 junit.framework.TestResult$1.protect(TestResult.java:110) 在 junit.framework.TestResult.runProtected(TestResult.java:128) 在 junit.framework.TestResult.run(TestResult.java:113) 在 junit.framework.TestCase.run(TestCase.java:124) 在 junit.framework.TestSuite.runTest(TestSuite.java:232) 在 junit.framework.TestSuite.run(TestSuite.java:227) 在 org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) 在 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) 在 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 在 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 原因:com.thoughtworks.selenium.SeleniumException:您不能一次启动多个会话 在 org.openqa.selenium.WebDriverCommandProcessor.start(WebDriverCommandProcessor.java:217) 在 org.openqa.selenium.WebDriverCommandProcessor.start(WebDriverCommandProcessor.java:208) 在 com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:82) ... 16 更多
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想这不是配置错误。如果我的理解是正确的,您正在创建
WebDriver
对象,然后用它创建DefaultSelenium
/Selenium
对象,然后启动 selenium 会话。然后 - 不要使用
DefaultSelenium.start()
方法。代码应该是这样的:
这可能对你有帮助。
I guess this is not a configuration error. If my understanding is correct you are are creating
WebDriver
object and then creatingDefaultSelenium
/Selenium
object with it and then starting the selenium session.then -- don't use
DefaultSelenium.start()
method.Code should be like this:
This might help you.
您是否看过 http://seleniumhq.org/docs/ 03_webdriver.html#webdriver-backed-selenium-rc? sudarsan 在 上一个答案是正确:不要执行
selenium.start
。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
.如果您想知道 Selenium IDE 中的 JUnit 代码是否会经历此异常,请参阅 http ://osdir.com/ml/selenium-users/2011-07/msg02107.html
If you wonder that the JUnit Code from the Selenium IDE throughs this exception, see http://osdir.com/ml/selenium-users/2011-07/msg02107.html