[英]How to execute selenium tests in GUI mode in Azure VM instance in which jenkins is installed
I have on VM with Jenkins installed hosted in Azure which is Linux operating system.I want to execute the selenium scripts in that VM through Jenkins.I am able to execute the tests in headless mode.But the problem here is I need to run the tests in GUI mode.Is there any workaround to run the automation scripts in GUI mode.Below are the things I have tried to run in GUI mode. 我在装有Jenkins的VM上托管在Linux操作系统Azure上,我想通过Jenkins在该VM中执行硒脚本。我能够以无头模式执行测试,但是这里的问题是我需要运行在GUI模式下进行测试。是否有任何解决方法可以在GUI模式下运行自动化脚本。以下是我尝试在GUI模式下运行的操作。
But I am not able to execute in GUI mode.Any help will be much appreciated. 但是我无法在GUI模式下执行任何帮助将不胜感激。
Chrome version : 65 Chrome版本:65
Below is the error log : 下面是错误日志:
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.13.0-36-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.15 seconds Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z' org.openqa.selenium.WebDriverException:未知错误:Chrome无法启动:异常退出(驱动程序信息:chromedriver = 2.33.506092(733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform = Linux 4.13.0-36-generic x86_64)(警告:服务器未安装提供任何堆栈跟踪信息)命令持续时间或超时:60.15秒构建信息:版本:'3.8.1',版本:'6e95a6684b',时间:'2017-12-01T18:33:54.468Z'
I found this example on Azure Pipelines repo. 我在Azure Pipelines回购中找到了此示例 。 I only managed to get it working after I copied this piece of code and the file xvfb.init . 复制这段代码和文件xvfb.init后,我才设法使其正常工作。
steps:
- script: |
sudo cp .azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
sudo service xvfb start
displayName: 'Start X Virtual Frame Buffer'
- script: |
export DISPLAY=:10
gulp test
displayName: 'Test'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.