詹金斯在背景模式下启动chromedriver(如无头模式)



我已经在windows 10机器上设置了Jenkins服务器。当运行作业(简称mvn test -DsuiteXmlFile=%TestSuite%(时,作业会成功编译并启动测试。我可以看到第一个被跳过,第二个失败,然后它开始一个接一个地通过。没有打开Chrome窗口,但当我登录任务管理器时,我可以看到它在后台打开了几个Chrome进程。当在CMD中调用mvn test -DsuiteXmlFile=TestSuite时(也在电源壳中(,它会在前面打开Chrome。查看Jenkins日志,我发现它在c:\System/TEMP/目录中创建了一个.bat文件并执行该批处理文件。我甚至尝试复制文件,放在我项目的根目录中,并通过CMD调用它,同样的.bat文件也能正常工作。詹金斯仍然在后台打开Chrome。知道是什么原因造成的吗?我该如何强迫Jenkins在Foreground中运行测试?

我的chromedriver vesion是78.0.3904.70(如果需要的话(。两种情况的日志相同:

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
18.11.2019 03:50:38.019 INFO  - [AutomationListener]:Staring to run test suite with 11 tests
Nov 18, 2019 3:50:38 AM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800}) on port 39924
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1574077841.726][WARNING]: Timed out connecting to Chrome, retrying...
Nov 18, 2019 3:50:43 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[1574077845.835][WARNING]: Timed out connecting to Chrome, retrying...
18.11.2019 03:50:55.489 INFO  - [BasePage]:The element: By.cssSelector: polygon is clicked
18.11.2019 03:50:55.494 INFO  - [AutomationListener]:----------------------------------------------------------------------
18.11.2019 03:50:55.495 INFO  - [AutomationListener]:Starting to run TestMethod test method
18.11.2019 03:50:55.495 INFO  - [AutomationListener]:----------------------------------------------------------------------

当Jenkins slave作为服务在后台运行时,它启动的每个程序,如运行批处理文件,也将在后台。解决方案是在前台将Jenkins slave作为常规程序运行。

是的,在我的情况下,从解决方案正在运行。

我还有一台窗口机器,我配置了Jenkins,还配置了机器内的从机,现在它每次都会在前台打开浏览器。

我知道这不是真正的解决方案,但它非常适合

最新更新