Home > Software engineering >  Webdriver Manager Chrome Headless Selenium Python: webdriver does not respond to options
Webdriver Manager Chrome Headless Selenium Python: webdriver does not respond to options

Time:05-11

System setup:

Details:

Currently, my test setup and the included test cases work under Chrome as a normal GUI call, and the test cases run through under those conditions.

from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=chrome_options)


class OpenDevcrowd(unittest.TestCase):
def setUp(self):
    #self.driver = webdriver.Firefox(service=Service(GeckoDriverManager().install()))
    self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
    self.driver.implicitly_wait(30)
    self.base_url = "https://www.google.com/"
    self.verificationErrors = []
    self.accept_next_alert = True

I have used the options from 2020/2021 to change my setup to headless.

I tried the following information from stackoverflow in my build, but had no success with it at all:

Issue:

It seems that the options (and I tried almost all the options from the information already found in stackoverflow) would not work anymore?

Only the GUI is still called, and the headless option is simply not used.

Questions:

Did the command range change somehow from 2020/21 to 2022?

Is it the webdriver manager that prevents the options from being called?

CodePudding user response:

--headless should come with --window-size

Ex: "--window-size=1920,1080"

  • Related