简体   繁体   English

在Windows上使用Jenkins运行Selenium测试时,如何在未实际登录到计算机时捕获屏幕截图?

[英]How to capture a screenshot when not actually logged into the machine during running Selenium tests with Jenkins on Windows?

We have a CI environment with Jenkins running a test suite of Selenium Tests in a Windows (XP and/or Windows 7) VM. 我们有一个CI环境,Jenkins在Windows(XP和/或Windows 7)VM中运行Selenium Tests测试套件。 If I am not physically logged into the VM running these tests via RDP, all I see are black (blank) PNGs. 如果我没有物理登录通过RDP运行这些测试的VM,我看到的只是黑色(空白)PNG。 I've tried all of the 'capture' methods available (both Base 64 encoded and file based) for multiple Selenium RC 2ish releases (eg 2.0b2, 2.0rc3, 2.0.0, 2.1.0) and I get the same results for everything I've tried. 我已经尝试了所有可用的“捕获”方法(Base 64编码和基于文件),用于多个Selenium RC 2ish版本(例如2.0b2,2.0rc3,2.0.0,2.1.0),我得到了相同的结果我尝试过的一切。 Is anyone else running Selenium in a Windows CI deployment and able to capture screens? 是否有其他人在Windows CI部署中运行Selenium并能够捕获屏幕? Or better stated, can anyone shed light on how I can capture screens in Windows, using the Selenium API without having to be physically on the box"? 或者更好地说,任何人都可以了解我如何在Windows中捕获屏幕,使用Selenium API而无需在物理上使用“?

If you are not logged onto the box, or you either closed or minimized the RDP connection, there is no desktop, and screen captures will be blank. 如果您未登录该框,或者您关闭或最小化了RDP连接,则没有桌面,并且屏幕截图将为空白。

What you need to do is use a VNC server/viewer, so that the machine/vm in question has a visible desktop session. 您需要做的是使用VNC服务器/查看器,以便有问题的机器/虚拟机具有可见的桌面会话。

We are also doing something very similar. 我们也在做一些非常相似的事情。 We have a windows VM setup which is running Hudson and Selenium Grid. 我们有一个运行Hudson和Selenium Grid的Windows VM设置。
When our test cases fail we capture a screenshot of the browser so we get more detail of why a test case failed. 当我们的测试用例失败时,我们会捕获浏览器的屏幕截图,以便我们更详细地了解测试用例失败的原因。
We are using the #captureEntirePageScreenshotToString method 我们正在使用#captureEntirePageScreenshotToString方法

We're doing it, and it works for us. 我们正在做,它对我们有用。 We're using JetBrains' TeamCity instead of Jenkins, running on Windows Server 2003. We run the Selenium RC server as a Windows service, using the Java Service Launcher . 我们使用JetBrains的TeamCity而不是Jenkins,在Windows Server 2003上运行。我们使用Java Service Launcher将Selenium RC服务器作为Windows服务运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM