简体   繁体   English

Sikuli,詹金斯的硒测试:允许浏览器在前台启动,就像我从开发机器运行它一样?

[英]Sikuli, selenium testing on Jenkins: Allow the browser to be launched in the foreground, as it is when i run it from development machine?

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. 问题在于,Sikuli的图像识别功能仅在Sikuli测试的目标位于前景并且可以完全访问鼠标时才起作用。 In its current configuration, Jenkins projects are never visible from the desktop of the windows slave node. 在其当前配置中,Jenkins项目永远不会从Windows从属节点的桌面上看到。

The way my current automated testing suite is setup right now, about 30 tests are written using only selenium. 我现在的自动化测试套件的设置方式,仅使用selenium编写了大约30个测试。 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. 在最后的两个测试中,selenium启动了一个webdriver(目前是chromedriver但可以是firefox或IE)并导航到正确的页面,Sikuli从那里做了它的事情。 Both use the java language bindings. 两者都使用java语言绑定。

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. 目前Sikuli似乎安装正确,但当要求点击通过将桌面与目标图像匹配而填充的screenRegions列表时,它会立即抛出NPE。

How do I change my Jenkins setup on my windows 7 slave to allow the browser to be launched in the foreground, as it is when i run it from my windows 7 development machine? 如何更改我的Windows 7 slave上的Jenkins设置以允许浏览器在前台启动,就像我从Windows 7开发机器运行它一样?

So you've got a development machine where Sikuli works, and a test machine where Jenkins runs Sikuli and it doesn't work. 所以你有一个Sikuli工作的开发机器,以及Jenkins运行Sikuli的测试机器,它不起作用。

I had this same setup (with the Sikuli tester/Jenkins slave running Windows 7). 我有相同的设置(Sikuli测试人员/ Jenkins奴隶运行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. 对我来说有用的是让测试机器运行VNC服务器,通过VNC登录测试器帐户,并将Jenkins从站作为常规应用程序而不是服务启动。 I used UltraVNC server . 我用过UltraVNC服务器

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. 据我所知,问题源于Windows的安全措施,这些措施旨在防止远程用户在没有您的情况下控制您的计算机。

If you run Jenkins as a service, it doesn't get a real desktop allocated to it. 如果您将Jenkins作为服务运行,则不会为其分配真正的桌面。 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. 脚本将运行,但(正如你所看到的)Sikuli实际上无法找到任何东西,因为它没有任何东西可供查看。 (Selenium is inspecting the page content programmatically, so it doesn't mind that the page is not actually displayed on any screen.) (Selenium正在以编程方式检查页面内容,因此不介意页面实际上没有显示在任何屏幕上。)

You can also just run Jenkins and leave yourself logged in, and skip the VNC server. 您也可以运行Jenkins并让自己登录,并跳过VNC服务器。 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!) (所以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. 作为附带好处,如果你这样做,你可以通过VNC连接并观看Jenkins运行测试。

  1. make the slave machine remote desktop to itself. 使奴隶机远程桌面自己。
  2. run the jenkins salve as program in that session cmd /c start java -jar slave.jar -jnlpUrl http....slave-agent.jnlp -secret ... (find it in your jenkins master (shown when the slave service is down) 运行jenkins salve作为该会话中的程序cmd / c启动java -jar slave.jar -jnlpUrl http .... slave-agent.jnlp -secret ...(在你的jenkins master中找到它(当奴隶服务是下)
  3. set it all to run at salve win startup. 将它全部设置为在salve win startup中运行。

暂无
暂无

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

相关问题 当我通过Jenkins运行Selenium脚本时,未在Jenkins服务器中实例化浏览器,但我的Jenkins构建已通过 - When I run my selenium scripts through Jenkins, browser was not instantiated in Jenkins server but my Jenkins build was pass Selenium无法从Jenkins运行Firefox浏览器 - Selenium Not able to run Firefox browser from Jenkins 当 Jenkins 运行测试时,无法看到浏览器上正在运行 Selenium 测试 - Unable to see Selenium tests are running on the browser when the test is run by Jenkins 如何强制在 jenkins 从节点上运行的 Selenium 测试在前台运行? - How can I force Selenium tests running on a jenkins slave-node to run in the foreground? Selenium和TestNg并行运行并未将驱动程序附加到我们启动的每个浏览器,即使我使用ThreadLocal概念 - Selenium and TestNg parallel run is not attaching driver to every browser that we launched even though i used ThreadLocal concept 硒测试在本地计算机上运行,​​但不通过詹金斯运行 - Selenium tests run on local machine but not through jenkins 如何在jenkins slave机器上运行selenium脚本,但脚本在Master机器中 - How to run selenium scripts in jenkins slave machine but the scripts are in Master machine 如何在 jenkins 中使用真实浏览器运行 selenium 脚本 - how to run selenium script with real browser in jenkins 将Selenium chrome驱动程序启动的Chrome浏览器与手动启动的Chrome浏览器区分开来 - Differentiating Chrome browser launched by Selenium chrome driver from manually launched Chrome Browser 从Jenkins运行时,Selenium GUI测试始终失败(无此元素) - Selenium GUI tests keep failing when run from Jenkins (no such element)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM