Question

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.

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 ?

Was it helpful?

Solution

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). 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top