Selenium Webdriver期间Firefox的多个实例测试不正确处理焦点。 [英] Multiple Instances of Firefox during Selenium Webdriver Testing not handling focus correctly.

查看:295
本文介绍了Selenium Webdriver期间Firefox的多个实例测试不正确处理焦点。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在网格上并行运行多个selenium firefox测试时,焦点事件处理无法正常工作。我已经证实,当我的每个测试都是单独运行的,并且给定OS的焦点时,测试通过100%的时间。我也使用Chrome在网格上并行运行测试,但没有看到现在的问题。

我在google组上找到了以下线程,建议在单独的xvfb实例中启动每个浏览器可能是一个可行的解决方案。
https:// groups .google.com / forum /?fromgroups#!topic / selenium-developers / 1cAmsYCp2ho%5B1-25%5D



测试部分失败是由于在项目中使用的jQuery日期选择器。日期选择器在焦点事件上启动,并且由于同时执行多个硒测试,webdriver测试执行.click()命令,但焦点不会保持足够长的时间才能显示日期选择器小部件。



.focus(function(){$ input.trigger(focus);});



我的问题是,如果有人看过这个,并通过一些Firefox的配置文件设置解决它。我已经尝试加载以下属性,对问题没有影响。

  profile.setAlwaysLoadNoFocusLib(true); 

测试失败的方式与之前使用的属性启用并加载到Remote Driver Firefox配置文件。

我需要一种方法确保焦点事件被触发100%的时间,或者解决多个Firefox浏览器竞争焦点的问题。考虑到Chrome显示器没有这些问题,我不知道它是否也可能被认为是Firefox中的错误。



谢谢!

解决方案

@djangofan:错了。你不能锁定焦点。当你在一个窗口中请求焦点并且在触发一个动作之前,另一个窗口请求焦点,并且你的动作(比如把键发送到输入字段)不起作用。这在我们的测试中每天发生几次。这是很难重现,因为每个测试运行失败在不同的地方。解决方案是在单独的显示器中执行每个浏览器。例如。您可以使用Xvfb:

  Xvfb ...-屏幕1 1200x800x24  - 屏幕2 1200x800x24 ... 

code>

然后当你启动一个浏览器时,给它分配一个单独的屏幕:

  browser.setEnvironmentProperty(DISPLAY,:N.1); 
browser.setEnvironmentProperty(DISPLAY,:N.2);
...


I have noticed that while running multiple selenium firefox tests in parallel on a grid that the focus event handling is not working correctly. I have confirmed that when each of my tests is run individually and given focus of the OS the tests pass 100% of the time. I have also run the tests in parallel on the grid with Chrome and not seen the issue present.

I have found the following thread on google groups which suggests launching each browser in a separate instance of xvfb may be a viable solution. https://groups.google.com/forum/?fromgroups#!topic/selenium-developers/1cAmsYCp2ho%5B1-25%5D

The portion of the test is failing is due to a jquery date picker which is used in the project. The date picker launches on a focus event and since there are multiple selenium tests executing at the same time the webdriver test executes the .click() command but focus does not remain long enough for the date picker widget to appear.

.focus(function(){ $input.trigger("focus"); });

My question is if anyone has seen this before and solved it through some firefox profile settings. I have tried loading the following property which had no affect on the issue.

profile.setAlwaysLoadNoFocusLib(true);

The test fails in the same way as it did before with that property enabled and loaded in the Remote Driver Firefox Profile.

I need a way ensure the focus event is triggered 100% of the time or to solve the issue of multiple firefox browsers competing for focus. Considering Chrome displays none of these issues I wonder if it may also be considered a bug in firefox.

Thanks!

解决方案

@djangofan: Wrong. You cannot lock the focus. After you requested focus in one window and before you trigger an action, another window requests focus, and your action (like sending keys to input field) just doesn't work. This happened in our tests several times daily. It was hard to reproduce, because with each test run it failed on different places. A solution is to execute each browser in a separate display. E.g. you can use Xvfb:

  Xvfb ... -screen 1 1200x800x24 -screen 2 1200x800x24 ...

Then when you start a browser, assign a separate screen to it:

  browser.setEnvironmentProperty("DISPLAY", ":N.1");
  browser.setEnvironmentProperty("DISPLAY", ":N.2");
  ...

这篇关于Selenium Webdriver期间Firefox的多个实例测试不正确处理焦点。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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