gpt4 book ai didi

ubuntu - Selenium 独立服务器不会启动 Firefox,除非在交互模式下(Ubuntu、PHP、Selenium 和 php-webdriver-bindings-0.9.0)

转载 作者:太空宇宙 更新时间:2023-11-03 17:01:36 25 4
gpt4 key购买 nike

我想这是我不太了解启动 Selenium Standalone 服务器的正确开关组合的情况,但这里......

我有一个 Ubuntu 桌面盒,我想通过 Selenium 在上面运行测试。所以我安装了最新的 Selenium Standalone 服务器 (selenium-server-standalone-2.21.0.jar)。我可以启动服务器的交互式 session 并让 Firefox 按照示例运行 here但是针对我的 Selenium 版本和我的 firefox 路径进行了修改,即/usr/bin/firefox。

当我以非交互模式启动服务器时,如下所示:

java -jar /usr/lib/selenium/selenium-server-standalone-2.21.0.jar -port 4444 > /var/log/selenium/selenium-output.log 2> /var/log/selenium/selenium-error.log & echo $! > /tmp/selenium.pid

然后我得到所有正确的反馈,表明服务器正在运行。但是,当我尝试从 php-webdriver-bindings-0.9.0 运行 example.php(修改为删除对“Internet Explorer”的引用)时,它会失败,因为 Firefox 从未启动。绝对没有从 example.php 返回到我的浏览器,但我可以看到服务器执行命令(尽管已将 ini_set("display_errors",1); 和 error_reporting(E_ALL); 添加到文件顶部)。错误和输出日志也没有显示任何错误,只是来自服务器启动的简单状态消息。

由于 PHP 只是将命令传递给服务器,在我看来,无论是否处于交互模式,服务器都将拥有相同的用户,因此不应该存在权限问题。

最终我想我会想要为大规模操作设置一个网格,但现在我真的想让这台服务器正常工作。

非常感谢任何帮助。

最佳答案

目前这对我有用:http://dionysus.uraganov.net/software/how-to-install-selenium-server-with-firefox-on-ubuntu-11-10/

更新:

好的。上面的链接是我第一次尝试设置 ci 环境。现在我有了这个启动命令,而且工作正常!

ci 服务器

Xvfb -fp /usr/share/fonts/X11/misc/ :22 -screen 0 1024x768x16 2>&1 &  
export DISPLAY=:22
java -jar /usr/lib/selenium/selenium-server-standalone.jar -role hub -multiWindow -browserSessionReuse -timeout 30000 -forcedBrowserModeRestOfLine "*firefox /usr/lib/firefox-9.0.1/firefox" 2>&1 &

任何 worker

java -jar /usr/lib/selenium/selenium-server-standalone.jar -role webdriver -hub http://[server-ip]:4444/grid/register -port 5555 -browser browserName=firefox,platform=LINUX,maxInstances=5

后续步骤
更多浏览器,selenium 和 xvfb 的启动脚本。对于 Selenium ,有两种资源:
https://github.com/feniix/selenium-grid-startup
http://www.danstraw.com/installing-selenium-server-2-as-a-service-on-ubuntu/2010/09/23/

关于ubuntu - Selenium 独立服务器不会启动 Firefox,除非在交互模式下(Ubuntu、PHP、Selenium 和 php-webdriver-bindings-0.9.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10613061/

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