将 DISPLAY 参数传递到 GNU 屏幕命令中以运行 Selenium

发布于 2024-08-29 17:44:51 字数 345 浏览 1 评论 0原文

我正在使用无头 VPS 运行多服务器 Selenium 测试环境。除了在屏幕会话中启动 Selenium 时需要声明 DISPLAY=:1 参数(由于运行 VNC 服务器)之外,我几乎将所有事情都自动化了。这是我想要使用的命令:

screen -d -m DISPLAY=:1 java -jar /root/Desktop/selenium-server-1.0.3/selenium-server.jar

我希望在启动时触发该命令以使 Selenium 运行,然后立即与屏幕分离。如果没有 DISPLAY 参数,这可以正常工作,但会忽略上述命令中的 DISPLAY 参数。

有什么建议吗?

I am running a multiserver Selenium testing environment using headless VPSs. I have nearly everything automated except for a specific need to declare the DISPLAY=:1 argument when starting Selenium within a screen session (due to running VNC server). Here is the command I'd like to work:

screen -d -m DISPLAY=:1 java -jar /root/Desktop/selenium-server-1.0.3/selenium-server.jar

I want this to fire at startup to have Selenium running, and then immediately detach from screen. This works fine without the DISPLAY argument, but ignores the DISPLAY argument in the above command.

Any suggestions?

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

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

发布评论

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

评论(1

想挽留 2024-09-05 17:44:51

在类似的情况下,我最终使用了 Saucelabs.com 服务,该服务为您提供配置工作。我真的很喜欢它的服务。

但是,让我们进入正题:似乎 screen 不继承父 shell,但有两种选择:

  • 首先,将显示包装到 shell 脚本中
  • 其次,使用 .screenrc setenv,如下例所示: setenv DISPLAY :1

希望有帮助。

Under a similar situation, I ended up on saucelabs.com service, which does the provisioning thing for you. I really like its service.

But, lets get to the point: It seems screen doesn't inherit the parent shell, but there are two alternatives:

  • First, wrap the display into a shell script
  • Second, use the .screenrc setenv, like this example: setenv DISPLAY :1

Hope that helps.

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