从Jenkins在Windows VM中运行Selenium Test时无法打开浏览器 [英] Unable to Open Browser when running Selenium Test in Windows VMs from Jenkins

查看:73
本文介绍了从Jenkins在Windows VM中运行Selenium Test时无法打开浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正尝试在Windows Slave上作为Gradle项目运行Jenkins的Selenium Tests.

We are trying to run Selenium Tests from Jenkins on our Windows Slaves as a Gradle project.

我能够从bat命令gradle clean Smoke_Test启动Selenium,并且开始执行测试,但是它会在后台打开浏览器(测试用例失败,并说它找不到要单击的按钮).如果我在Windows VM上手动运行gradle clean Smoke_Test,它将启动Selenium,在Foreground中打开浏览器,并成功执行测试.

I am able to start Selenium from bat command gradle clean Smoke_Test and the test execution starts but it opens the browser in Background (the test case fails and it says that it cannot find a button to click on). If I manually run gradle clean Smoke_Test on the windows VM, it starts Selenium, opens the browser in Foreground and it executes the test successfully.

当詹金斯(Jenkins)启动硒测试时,是否可以使浏览器在前台打开?

Is it possible to get the browser open in foreground when Jenkins starts the Selenium Test?

我试图授予Jenkins-Slave Windows Service权限以允许服务与桌面交互,但是它仍然无法正常工作.

I have tried to give Jenkins-Slave Windows Service permissions to Allow service to interact with desktop but it still does not work.

编辑:由于Windows Server是从服务器,因此我必须将Jenkins作为服务运行.由于企业限制,我无法运行java -jar Jenkins.war.

I have to run Jenkins as a Service as the Windows Server is a slave. I cannot run java -jar Jenkins.war due to Enterprise restrictions.

推荐答案

如@Greg所述,我试图解决一个错误的问题.由于我的Chrome驱动程序,通过Jenkins执行我的测试用例失败.我将Chrome驱动程序更改为Headless版本,并通过了测试用例(当然,Chrome在后台运行!).

As @Greg mentioned, I was trying to solve a wrong problem. My test case was failing when executing through Jenkins because of my Chrome Driver. I changed the Chrome Driver to the Headless version and the test cases passed (with Chrome in Background, of course!).

这篇关于从Jenkins在Windows VM中运行Selenium Test时无法打开浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆