When I execute multiple test simultaneously, i don\'t want to keep Firefox browser window visible.. I can minimize it using selenium.minimizeWindow()
but I don\
If you are using KDE Desktop, you can make Firefox Windows to be initially opened being minimized. That made my day to me regarding this problem. Just do the following:
These settings will apply for new Firefox windows from now on and you will not be bothered with pop-ups anymore when running tests with Webdriver.
If you're using Selenium RC or Remote WebDriver then you can run the browser instance on a remote, or virtual machine. This means that you shouldn't have to worry about hiding the browser windows as they won't be launching on your local machine.
Just add the following code.
import os
os.environ['MOZ_HEADLESS'] = '1'
driver = webdriver.Firefox()
just add these and it will work if you are using chrome, also useful in firefox
from selenium.webdriver.chrome.options import Options
'''option to make driver work background'''
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
Firefox has a headless mode. If you want to use it, you just have to set it on binary options like this:
binary = FirefoxBinary("C:/Program Files/Mozilla Firefox/firefox.exe")
options = webdriver.FirefoxOptions()
# set headless mode on
options.set_headless(True)
driver = webdriver.Firefox(firefox_binary=binary,options=options)
in options (Firefox options, chrome options )
set boolean headless to true by calling set_headless method.