简体   繁体   中英

Webdriver Manager+Chrome Headless+Selenium+Python: webdriver does not respond to options

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?

--headless should come with --window-size

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM