简体   繁体   English

Selenium:如何阻止浏览器窗口每次获得顶部显示?

[英]Selenium: How to stop the browser window getting on-top for every get?

Everytime I do a get, 每当我努力的时候

    for a in al: 
        browser.get(a)
        ...

the window of the browser gets on-top and I cannot do other things on the computer. 浏览器窗口打开,我无法在计算机上执行其他操作。

I am using python, Chrome driver and Windows 7. 我正在使用python,Chrome驱动程序和Windows 7。

How can I make the browser to stay in the backround and prevent it to get on-top of other windows every-time the browser.get(a) is taking place ? 如何使浏览器停留在背景中,并防止browser.get(a)每次发生browser.get(a)时都进入其他窗口的顶部?

When the browser is launched, it's up to the OS whether it comes up in focus/in front or not, there's not much you can do (unless you modify Selenium itself to change the way it launches the subprocess with the browser in it). 启动浏览器时,是否在操作系统焦点或前端取决于操作系统,您将无能为力(除非您修改Selenium本身以更改其中使用浏览器启动子进程的方式)。 If you are on an OS that supports it though, you could integrate pyvirtualdisplay in to your tests and launch Selenium in to an XVFB session or something similar, though then you'd need to switch the virtual display off if you wanted to be able to watch the test run in the browser. 如果您使用的是支持此功能的操作系统,则可以将pyvirtualdisplay集成到测试中,然后将Selenium启动到XVFB会话或类似的程序中,但是如果您希望能够关闭虚拟显示,则可以在浏览器中观看测试运行。

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

相关问题 获取Selenium 2(WebDriver)中当前打开的浏览器窗口 - Get current opened browser window in selenium 2 (WebDriver) 有什么办法可以停止python的Selenium Web驱动程序打开浏览器窗口 - is there any way to stop selenium web driver for python opening a browser window 使用 Selenium Python 获取浏览器 window 大小 - Get browser window size using Selenium Python 如何让 selenium 打开一个浏览器并继续使用该浏览器,而不是为每个 url/scrape javascript 加载一个新浏览器 - How do I get selenium to open one browser and keep using that browser instead of loading a new browser for every url / scrape javascript 如何在 selenium python 中最小化打开浏览器 window? - How to open browser window as minimized in selenium python? 如何使用sharex = True在catplot(kind ='violin')的顶部对seaborn catplot(kind ='count')进行子图绘制 - How to subplot seaborn catplot (kind='count') on-top of catplot (kind='violin') with sharex=True Python Selenium:如何使浏览器窗口无法打开 - Python Selenium: How to make browser window not open 如何使用硒获得浏览器分辨率? - How to get browser resolution with selenium? 尝试获取 Selenium 以在初始加载期间停止浏览器 - Trying to get Selenium to stop the browser during initial load 我们可以让 Selenium 专注于打开的浏览器 window 吗? - Can we get Selenium to focus on an open browser window?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM