Sikuli,Jenkins的硒测试:允许浏览器在前台启动,因为它是当我从开发机器运行它? [英] Sikuli, selenium testing on Jenkins: Allow the browser to be launched in the foreground, as it is when i run it from development machine?

查看:1041
本文介绍了Sikuli,Jenkins的硒测试:允许浏览器在前台启动,因为它是当我从开发机器运行它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是,Sikuli的图像识别功能只有在Sikuli测试的目标在前台并且完全访问鼠标时才能工作。在当前配置中,Jenkins项目从Windows从节点的桌面永远不可见。

The issue is that Sikuli's image recognition capabilities only work when the target of the Sikuli tests is in the foreground and it has full access to the mouse. In its current configuration, Jenkins projects are never visible from the desktop of the windows slave node.

目前的自动测试套件的设置方式,大约有30个测试只使用了selenium。在最后两个测试中,硒启动一个webdriver(目前chromedriver,但可以是firefox或IE),导航到正确的页面,Sikuli从那里做它的东西。两者都使用java语言绑定。

The way my current automated testing suite is setup right now, about 30 tests are written using only selenium. In the final two tests, selenium starts a webdriver (currently chromedriver but can be firefox or IE) and navigates to the right pages and Sikuli does its thing from there. Both use the java language bindings.

目前Sikuli似乎已正确安装,但当要求点击通过匹配桌面与目标图像填充的screenRegions列表时,它会立即抛出NPE。

Currently Sikuli appears to be installed correctly, but when it is asked to click through a list of screenRegions supposedly populated by matching the desktop with a target image, it immediately throws a NPE.

如何更改我的Windows 7从属的Jenkins设置,允许浏览器在前台启动,因为它是从我运行它Windows 7开发机?

推荐答案

所以你有一个开发机器Sikuli工作,

So you've got a development machine where Sikuli works, and a test machine where Jenkins runs Sikuli and it doesn't work.

我有这个相同的设置(使用运行Windows 7的Sikuli测试器/ Jenkins从服务器)。对我有用的是让测试机运行VNC服务器,通过VNC作为测试员帐户登录,并启动Jenkins从属服务器作为常规应用程序,而不是服务。我使用了 UltraVNC服务器

I had this same setup (with the Sikuli tester/Jenkins slave running Windows 7). What worked for me was to have the test machine run a VNC server, log in as a the tester account over VNC, and launch the Jenkins slave as a regular application and not a service. I used UltraVNC server.

至于我可以说,这个问题来自于Windows的安全措施,这些措施旨在防止远程用户在没有您的存在的情况下控制您的计算机。

As far as I could tell, the problem stems from Windows' security measures, which are designed to prevent a remote user from controlling your machine without your presence.

如果您运行Jenkins作为服务,它不会得到一个真正的桌面分配给它。脚本将运行,但是(如你所见)Sikuli实际上不能找到任何东西,因为没有什么可以看。 (Selenium正在以编程方式检查网页内容,因此它不会在任何屏幕上显示该网页。

If you run Jenkins as a service, it doesn't get a real desktop allocated to it. The script will run, but (as you're seeing) Sikuli won't actually be able to find anything because there's nothing for it to look at. (Selenium is inspecting the page content programmatically, so it doesn't mind that the page is not actually displayed on any screen.)

您也可以只运行Jenkins并让自己登录,并跳过VNC服务器。我想运行机器没有显示器或键盘,仍然有控制,虽然。如果这也是你的目标,你不能使用远程桌面,因为它分配一个新的桌面连接,然后在断开连接时销毁它。 (所以Jenkins会在你看着的时候工作,当你离开的时候失败。非常令人沮丧!)

You can also just run Jenkins and leave yourself logged in, and skip the VNC server. I wanted to run the machine without a monitor or keyboard and still have control, though. If that's your goal as well, you can't use Remote Desktop, because it allocates a new desktop on connection and then destroys it when you disconnect. (So Jenkins will work when you're watching and fail when you leave for the night. Very frustrating!)

作为一个好处,如果你这样做可以通过VNC连接并观看Jenkins,因为它正在运行测试。

As a side benefit, if you do it this way you can connect over VNC and watch Jenkins as it's running the test.

这篇关于Sikuli,Jenkins的硒测试:允许浏览器在前台启动,因为它是当我从开发机器运行它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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