如何防止Selenium RC在我的测试运行时偷取窗口焦点? [英] How do I prevent Selenium RC from stealing window focus while my tests are running?

查看:280
本文介绍了如何防止Selenium RC在我的测试运行时偷取窗口焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可能只是一小部分,但是我同时使用我的机器进行测试。总是以我的方式得到的东西是,当我使用Selenium RC运行测试用例时,浏览器窗口总是在窃取焦点。这样可以防止我在每天退出之前的一天结束之前多次运行我的测试。我尝试了Selenium Grid,但是我不能只听localhost上的请求,而不是0.0.0.0(来自我的网络管理员的一个要求)。

我已经通过Selenium文档挖掘了许多Selenium站点,但是我还没有找到明确的答案。我可以防止从我的测试运行时盗取Windows焦点硒RC测试吗?



我使用Firefox 3.6.13。

更新



。如果您像我一样将Selenium作为独立服务器运行,那么您可以添加以下内容:

  -browserSessionReuse 

到启动Selenium测试用例的ant任务。这也节省了相当多的时间,因为在硒测试运行时,我不必等待两个新的Firefox窗口打开。解决方法是每次测试开始时,如果每个测试都是独立测试,则必须注销网站。我通过编辑我的登录方法来快速完成此操作,以查找我的注销链接。如果注销链接存在,我的测试点击注销链接,并等待登录页面可用,然后继续测试。


I know I'm probably in a small minority, but I have to use my machine at the same time my tests are running. The thing that always gets in my way is that the browser window is always stealing focus when I run test cases using Selenium RC. Which prevents me from running my tests more than once a day, at the end of the day right before I log out. I tried Selenium Grid, but I can't get it to only listen for requests on localhost, not 0.0.0.0 (a requirement from my network admin).

I've dug through the Selenium documentation, and tons of Selenium sites, but I haven't been able to find a definitive answer. Can I prevent Selenium RC tests from Stealing windows focus while my test are running?

I'm using Firefox 3.6.13.

解决方案

UPDATE

I found a work-around to my focus stealing Firefox window. If you are running Selenium as a stand-alone server as I am, then you can add this:

-browserSessionReuse

To the ant task that launches your Selenium test cases. This saves considerable time as well because I don't have to wait for two new Firefox windows to open up while the selenium tests are running. The work around is that you will have to log out of your site every time a test starts, if each of your tests is a standalone test. I accomplished this quickly by editing my log in method to look for my log out link. If the log out link is present then my test clicks the log out link, and waits for the log in page to be available, then continues on with the test.

这篇关于如何防止Selenium RC在我的测试运行时偷取窗口焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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