我在维护运行在jenkins slave上的selenium服务器时遇到了问题。我使用以下代码来运行selenium
java -jar /opt/selenium-server-standalone-2.53.0.jar -Dwebdriver.chrome.args="--use-gl=osmesa" -Dwebdriver.chrome.driver=/usr/bin/chromedriver -Dwebdriver.chrome.bin=/usr/bin/google-chrome -log /var/log/selenium/selenium.log > /var/log/selenium/output.log 2> /var/log/selenium/error.log & echo $! > /tmp/selenium.pid但是我总是遇到selenium服务器死掉的问题。有没有人能告诉我维护硒的最好方法?关于维护selenium服务器,我应该知道哪些最佳实践?
在运行selenium测试时,我有时会遇到以下错误
tests/npw Connection refused! Is selenium server started?
tests/npw { sessionId: null,
status: 13,
state: 'unhandled error',
value:
{ message: 'Read timed out',
suppressed: [],
localizedMessage: 'Read timed out',
cause: null,
class: 'java.net.SocketTimeoutException',
hCode: 1232868082,
screen: null },
class: 'org.openqa.selenium.remote.Response',
hCode: 1242507638 } 发布于 2016-10-05 14:39:16
您可以做的一件事是尝试在Jenkins节点中运行Selenium服务器,以便与主服务器完成的其他可能的作业和功能分开。将其配置为服务,并配置为在服务器启动时自动运行。
对于Centos OS:在/etc/systemd/system/selenium-node.service中创建一个文件
添加以下内容:
[Unit]
Description=Run a selenium node
[Service]
ExecStart=/usr/bin/java -jar /route/to/selenium/selenium-server-standalone-2.52.0.jar -role node blablabla
Restart=on-abort
[Install]
WantedBy=multi-user.target然后运行:
sudo systemctl daemon-reload
sudo systemctl start selenium-node.service这样,它将自动重新启动,并将始终运行。
发布于 2016-10-05 15:04:18
首先,您必须确保命令是正确的。
Jenkins只是一个调度tool.If,你可以手动运行这些命令,但不能在Jenkins运行时运行,这可能是因为权限问题。
https://stackoverflow.com/questions/39866379
复制相似问题