gpt4 book ai didi

java - 无法启动 Selenium session : Failed to start new browser session: Error while launching browser

转载 作者:行者123 更新时间:2023-12-04 06:49:52 25 4
gpt4 key购买 nike

我像初始化 Selenium 一样

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

我用类似的方法编写我的测试
public void testUntitled() throws Exception
{
boo();
foo();
}

但它给出了类似的错误
 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:223)
at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:81)...19 more

我自己和谷歌结果都找不到解决方案。任何帮助将不胜感激。

不管怎么说,还是要谢谢你。

最佳答案

Firefox 只允许每个配置文件的一个实例。如果您没有为它配置任何东西并且在开始测试时您的 Firefox 浏览器是打开的。 Firefox 阻止 selenium 使用它。

在 Firefox 中配置配置文件,您可以配置 selenium 以使用 ff 配置文件

当您运行 Selenium Server 时,与服务器一起运行
命令行选项 -firefoxProfileTemplate“配置文件的路径”

(如果你没有配置)

Configuring profiles in FF

关于java - 无法启动 Selenium session : Failed to start new browser session: Error while launching browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3289227/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com