Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide Firefox window (Selenium WebDriver) in python test

I have a python test and I want to run it without opening the firefox

I want to hide it so how can I do this ?

any help ?

like image 541
munia ali Avatar asked Mar 16 '17 09:03

munia ali


1 Answers

Headless:

# pip install selenium
from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.add_argument('--headless')

driver = webdriver.Firefox(options=options)
driver.get('https://www.google.com/doodles')

print('Title: "{}"'.format(driver.title))
driver.quit()
like image 172
gil9red Avatar answered Sep 18 '22 23:09

gil9red