如何使用Selenium RC关闭或最小化浏览器窗口? [英] How to close or minimize browser windows with Selenium RC?
问题描述
-
附加组件窗口通知我
已经安装了3个新的附加组件
(因为我使用
的Selenium自定义配置文件,显然它增加了
DocumentReadyState,KillFF和
Selenium RC Runner插件)
-
http:// localhost:4444 / selenium-server / core / Blank.html?start = true
-
带有两个标签的双窗口,以chrome开头://src/content/RemoteRunner.html?sessionId = ...每个
我不需要其中的任何一个,每次我必须手动关闭加载项窗口,最小化另外两个窗口,并使Selenium控制的主浏览器窗口最大化。经历了这么多次后,我感到非常恼火以寻求解决方案:
是否有任何方法可以自动关闭附加组件窗口并最小化另外两个窗口?
顺便说一下,我在OS X上,所以我也很感激一些替代的解决方案,通过操作系统自动化这个,而不是直接使用Selenium。
您可以在自定义配置文件中更改一些首选项,以防止添加窗口和附加选项卡startup:
- 设置
extensions.lastAppVersion
首选项为您的Firefox版本
- 将
extensions.newAddons
首选项设置为false
。 - 将
extensions.update.notifyUser
首选项设置为false
。 >
可能还有一些,或许其他人可以在评论中提供他们的建议eir自己的答案。
只要Selenium运行在多窗口模式下(默认模式),您将得到两个浏览器窗口。您可以使用以下命令最大化主窗口:
selenium.windowMaximize();
或者使用multiWindow命令行参数禁止使用多重窗口,只使用一个窗口 - 请注意,这会导致某些网站出现问题,特别是当他们试图打破框架。
Every time I launch a Firefox instance via Selenium RC I get 3 windows that I don't need appearing:
the add-ons windows notifying me that "3 new add-ons have been installed" (since I'm using a custom profile for Selenium to which it evidently adds the DocumentReadyState, KillFF, and Selenium RC Runner add-ons)
the http://localhost:4444/selenium-server/core/Blank.html?start=true window
the dual window with two tabs starting with chrome://src/content/RemoteRunner.html?sessionId=... each
I don't need any of these to be visible, and each time I have to manually close the add-ons window, to minimize the two other windows, and to maximize the main browser windows which Selenium controls. After going through this too many times, I got annoyed enough to seek a solution:
Is there any way to automate closing the add-ons window and minimizing the two other windows?
By the way, I'm on OS X so I'd also appreciate some alternative solution which automates this via the OS instead of directly using Selenium.
There's a few preferences you can change in your custom profile to prevent the addons window and the additional tab on startup:
- Set the
extensions.lastAppVersion
preference to the version of Firefox that you have installed. - Set the
extensions.newAddons
preference tofalse
. - Set the
extensions.update.notifyUser
preference tofalse
.
There might be some more, perhaps others can provide their suggestions in comments or their own answers.
As long as Selenium is running in multi window mode (the default mode) you'll get two browser windows. You could either maximize the main window using the following command:
selenium.windowMaximize();
Or use the multiWindow command line parameter to disable the use of multuple windows and just use a single window - note that this causes issues on some websites, especially if they attempt to break out of frames.
这篇关于如何使用Selenium RC关闭或最小化浏览器窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!