[Tutor] Pass options in one line (Selenium)
Julius Hamilton
juliushamilton100 at gmail.com
Thu Oct 28 11:45:35 EDT 2021
Hey,
Would anyone know how to do the following in fewer lines?
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options = options)
Basically, I’d like to do this:
driver = webdriver.Firefox(options = Options().headless = True)
But the only issue is trying to instantiate a class, then modify a
property, and passing that as the argument to something else, all at once.
Maybe Options(self.headless = True)?
Thanks very much,
Julius
More information about the Tutor
mailing list