收到“无法启动 Selenium 会话:内部服务器错误” 运行硒测试时出错

发布于 2024-07-19 01:16:42 字数 1910 浏览 5 评论 0原文

这是当我尝试通过网络服务器上的 build.xml 运行我的 selenium 脚本时遇到的错误:

@BeforeTest设置

java.lang.RuntimeException: Could not start Selenium session: Internal Server Error   
 at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)   
 at com.doubleclick.richmedia.selenium.InpageEndToEnd.createSeleniumClient(InpageEndToEnd.java:34)   
 at com.doubleclick.richmedia.selenium.InpageEndToEnd.setUp(InpageEndToEnd.java:27)   
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)   
Caused by: com.thoughtworks.selenium.SeleniumException: Internal Server Error   
 at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)   
 at com.thoughtworks.selenium.HttpCommandProcessor.getCommandResponseAsString(HttpCommandProcessor.java:168)   
 at com.thoughtworks.selenium.HttpCommandProcessor.executeCommandOnServlet(HttpCommandProcessor.java:104)   
 at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:86)   
 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)   
... 26 more   
 ... Removed 23 stack frames 

这是我的 @BeforeTest 脚本:

@测试前

public void setUp() throws Exception {<br>
createSeleniumClient("http://www.google.com");<br>
}

protected DefaultSelenium createSeleniumClient(String url) throws Exception {
    selenium =  new DefaultSelenium("localhost", 4444, "*firefox", url);
    selenium.start();
    selenium.setSpeed("2000");
    selenium.deleteAllVisibleCookies();
    return selenium;
}

我在这里做错了什么吗? 我能够通过 IntelliJ 在本地运行它。 谢谢。

This is the error I'm getting when I try to run my selenium script through a build.xml on a network server:

@BeforeTest Setup

java.lang.RuntimeException: Could not start Selenium session: Internal Server Error   
 at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)   
 at com.doubleclick.richmedia.selenium.InpageEndToEnd.createSeleniumClient(InpageEndToEnd.java:34)   
 at com.doubleclick.richmedia.selenium.InpageEndToEnd.setUp(InpageEndToEnd.java:27)   
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)   
Caused by: com.thoughtworks.selenium.SeleniumException: Internal Server Error   
 at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)   
 at com.thoughtworks.selenium.HttpCommandProcessor.getCommandResponseAsString(HttpCommandProcessor.java:168)   
 at com.thoughtworks.selenium.HttpCommandProcessor.executeCommandOnServlet(HttpCommandProcessor.java:104)   
 at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:86)   
 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)   
... 26 more   
 ... Removed 23 stack frames 

And here's my @BeforeTest script:

@BeforeTest

public void setUp() throws Exception {<br>
createSeleniumClient("http://www.google.com");<br>
}

protected DefaultSelenium createSeleniumClient(String url) throws Exception {
    selenium =  new DefaultSelenium("localhost", 4444, "*firefox", url);
    selenium.start();
    selenium.setSpeed("2000");
    selenium.deleteAllVisibleCookies();
    return selenium;
}

Am I doing something wrong here? I was able to run this locally through IntelliJ.
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你怎么这么可爱啊 2024-07-26 01:16:42

这可能听起来像是一个奇怪的问题,但是你真的在“url”中逐字传递“url”吗?

createSeleniumClient("url");

不是有效的 url,所以我希望 Selenium 会在这里抱怨。

This may sound like a strange question, but are you really passing "url" literally in

createSeleniumClient("url");

"url" is no valid url and so I'd expect Selenium to complain here.

拍不死你 2024-07-26 01:16:42

您是否确保拥有同一版本的 Selenium 服务器 jar 和 java 客户端 jar ? 我不小心安装了服务器版本 0.9.2 和客户端 jar 1 beta,并收到此错误。 确保我使用 0.9.2 客户端 jar 进行编译解决了我的问题。

Have you made sure that you have both the Selenium server jar and the java client jar from the same version? I accidentally had server version 0.9.2 and client jar 1 beta and was getting this error. Making sure I was compiling with the 0.9.2 client jar fixed the issue for me.

画骨成沙 2024-07-26 01:16:42

您是否已验证您尝试执行测试的网络服务器正在运行 Selenium 服务器? 该错误看起来像是 RC 代码在连接到服务器以启动测试时遇到问题...

我建议首先尝试在构建机器上手动执行测试,以确保所有内容都配置正确。

Have you verified that the network server that you're trying to execute the tests on is running the Selenium Server? The error looks like the RC code is having trouble connecting to the server to start the tests...

I'd suggest trying to execute the tests manually on the build machine at first in order to ensure that everything is configured properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文