Selenium Webdriver可以在后台静默打开浏览器窗口吗? [英] Can Selenium Webdriver open browser windows silently in background?

查看:254
本文介绍了Selenium Webdriver可以在后台静默打开浏览器窗口吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个硒测试套件,可以运行许多测试,并且在每个新测试中,它都会在我打开的任何其他窗口之上打开一个浏览器窗口.在本地环境中工作时非常刺耳.有什么办法告诉硒或操作系统(MAC)在后台打开窗口?

I have a selenium test suite that runs many tests and on each new test it opens a browser window on top of any other windows I have open. Very jarring while working in a local environment. Any way to tell selenium or the OS (MAC) to open the windows in the background?

推荐答案

有几种方法,但这不是简单的设置配置值".除非您投资不符合所有人需求的无头浏览器,否则它会有点骇人听闻:

There are a few ways, but it isn't a simple "set a configuration value". Unless you invest in a headless browser, which doesn't suit everyone's requirements, it is a little bit of a hack:

如何隐藏Firefox窗口(Selenium WebDriver)?

是否可以在Selenium中隐藏浏览器RC?

您可以应该"将一些参数传递到Chrome中,特别是:--no-startup-window

You can 'supposedly', pass in some parameters into Chrome, specifically: --no-startup-window

请注意,对于某些浏览器(尤其是IE),如果不集中精力运行它会损害您的测试.

Note that for some browsers, especially IE, it will hurt your tests to not have it run in focus.

您还可以使用AutoIT进行修改,以在打开窗口后隐藏该窗口.

You can also hack about a bit with AutoIT, to hide the window once it's opened.

这篇关于Selenium Webdriver可以在后台静默打开浏览器窗口吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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