如何配置 selenium-server 以使用 Eclipse 中的代理服务器

发布于 2024-10-01 10:16:02 字数 576 浏览 1 评论 0原文

当我从 Selenium-IDE 运行 Selenium 测试时,一切正常,但是当我将此测试导出到 Java 并从 Eclipse 将其作为 JUnit 测试运行时,在尝试从 googleapis 检索 jQuery 时出现超时。

我相信这是因为当我以这种方式运行时,selenium-server 会覆盖我的代理设置。我看到了一些关于如何配置 Selenium 以在从命令行运行时使用代理服务器的建议,因此我尝试将其应用于 Eclipse。我右键单击 selenium-server.jar,运行方式 ->运行配置...,单击 (x)=参数选项卡,并将其添加到程序参数中:

-Dhttp.proxyHost=myproxy.com
-Dhttp.proxyPort=80

但这仍然不起作用。谁能建议如何配置 SeleniumServer 在从 Eclipse 运行时使用我的代理?谢谢!

更新:

我也尝试将这些参数放入 VM Arguments 部分,但没有结果。我已经因这个问题正式获得了风滚草徽章...当然*有人*有建议!

When I run my Selenium tests from Selenium-IDE everything works fine, but when I export this test to Java and run it as a JUnit test from Eclipse, I get a timeout when trying to retrieve jQuery from googleapis.

I believe this is because selenium-server overrides my proxy settings when I run it this way. I have seen some suggestions as to how to configure Selenium to use a proxy server when running from the command line, so I tried to apply this to Eclipse. I right-click on selenium-server.jar, Run As -> Run Configurations..., click on the (x)=Arguments tab, and add this to Program arguments:

-Dhttp.proxyHost=myproxy.com
-Dhttp.proxyPort=80

But this still doesn't work. Can anyone suggest how to configure SeleniumServer to use my proxy when running from Eclipse? Thanks!

Update:

I have also tried putting these arguments in the VM Arguments section, but with no results. I have officially earned the Tumbleweed badge for this question... Surely *somebody* has a suggestion!

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

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

发布评论

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

评论(1

海的爱人是光 2024-10-08 10:16:02

尝试为这些设置系统属性

System.setProperty(key, value)

示例所示

System.setProperty("http.proxyHost", "myProxyServer.com");
System.setProperty("http.proxyPort", "80");

Try setting the system properties for these
as in

System.setProperty(key, value)

example

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