英文:
Selenium Won't Start - Ubuntu 14
问题
我正在尝试运行一个无头的 Selenium(使用 xvfb)。我使用 Selenium 独立的 jar 文件来实现这一点。我尝试手动完成所有操作,但无法启动服务器。在这种情况下,我运行以下命令:
在第一个终端窗口中:
Xvfb -fp /usr/share/fonts/X11/misc/ :10 -screen 0 1024x768x16 2>&1 &
export DISPLAY=:10
一旦这个命令运行没有错误,我打开一个新的终端窗口并运行:
java -jar /usr/lib/selenium/selenium-server-standalone-2.46.0.jar -port 4444
这个命令尝试启动很长时间,看起来像这样:
在保持这两个终端窗口打开的同时,我尝试连接到位于 127.0.0.1:4444 的 Selenium 服务器(使用一个名为 golang selenium 的包),但是我得到了一个连接被拒绝的错误。基于此,我尝试使用一个名为 "selenium-standalone" 的 npm 包。我按照这里的说明进行了安装。 然后我尝试使用以下命令启动服务器:
xvfb-run --server-args="-screen 0, 1366x768x24" selenium-standalone start -- -debug
这样做给我提供了更详细的输出,但没有解决方案。我仍然遇到连接被拒绝的问题。使用 xvfb-run 结合 selenium-standalone 运行的终端输出如下(至少是其中的尾部):
如果您对如何进一步排除故障有任何见解,将不胜感激。
附注:我已经确认了我的 golang 应用程序和我在其中使用的 Selenium 封装都可以连接到一个正常工作的 Selenium 服务器。曾经它是可以运行的,一切都很好- 没有更改过任何 Go 代码,但我就是无法可靠地启动这个 Selenium 服务器。
英文:
I'm attempting to run a headless (using xvfb) copy of selenium. I'm using the selenium standalone jar file to do this. I've attempted to do all of this manually and could not get the server to run. In this case, I run the following commands:
In the first terminal window:
Xvfb -fp /usr/share/fonts/X11/misc/ :10 -screen 0 1024x768x16 2>&1 &
export DISPLAY=:10
Once this is running without errors I open a new terminal window and run:
java -jar /usr/lib/selenium/selenium-server-standalone-2.46.0.jar -port 4444
This attempts to boot up for a very, very long time and looks like:
While leaving both of these terminal windows open I attempt to connect to the selenium server on 127.0.0.1:4444 (using a golang selenium package) and I get a refused connection. From this I attempted to utilize a package called 'selenium-standalone' that I found in the npm repository. I've installed that per instructions here. I then attempted to run the server with:
xvfb-run --server-args="-screen 0, 1366x768x24" selenium-standalone start -- -debug
Doing so gives me a more detailed output, but no resolution. I'm still getting refused connections. The output from the terminal for running the xvfb-run in combo with selenium-standalone is as follows (well, at least the tail end of it):
Any insight in how I could/should move forward with troubleshooting this would be greatly appreciated.
p.s. I have confirmed that the golang app and the selenium wrapper I'm using in my golang app are both working and can connect to a working selenium server. At one point it was running and everything was fine- no go code has changed and I just can't get this selenium server to start reliably.
1: http://i.stack.imgur.com/XNDQ2.png
2: https://www.npmjs.com/package/selenium-standalone
3: http://i.stack.imgur.com/YkKrG.png
答案1
得分: 1
我按照这个指南运行了无头浏览器,一切都很顺利。如果你也想尝试,我建议先删除selenium及其所有相关文件,然后从头开始。祝你好运!
英文:
I ran selenium headless following this guide and it ran flawlessly. If you try it, I would recommend removing selenium and and all associated files, and starting again from scratch. Good luck.
答案2
得分: 1
设置无头Selenium服务器通过xvfb
并不容易。这里有一个很好的例子,用于在Docker容器中构建一个带有Chrome浏览器的独立Selenium服务器:https://github.com/SeleniumHQ/docker-selenium/blob/master/StandaloneChrome/entry_point.sh
你可以将浏览器指向http://localhost:4444/wd/hub
来验证Selenium服务器是否成功启动。
英文:
setup working headless selenium server by xvfb
is not easy. here's one good example which is used in building a standalone selenium server with chrome browser in a docker container: https://github.com/SeleniumHQ/docker-selenium/blob/master/StandaloneChrome/entry_point.sh
you should point your browser to http://localhost:4444/wd/hub
to verify if the selenium server is started successfully.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论