简体   繁体   English

Webdriver Manager+Chrome Headless+Selenium+Python:webdriver不响应选项

[英]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.目前,我的测试设置和包含的测试用例在 Chrome 下作为普通的 GUI 调用工作,并且测试用例在这些条件下运行。

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.我已使用 2020/2021 年的选项将我的设置更改为无头。

I tried the following information from stackoverflow in my build, but had no success with it at all:我在构建中尝试了来自 stackoverflow 的以下信息,但根本没有成功:

Issue:问题:

It seems that the options (and I tried almost all the options from the information already found in stackoverflow) would not work anymore?似乎这些选项(我尝试了stackoverflow中已经找到的信息中的几乎所有选项)不再起作用了?

Only the GUI is still called, and the headless option is simply not used.只有 GUI 仍然被调用,headless 选项根本没有使用。

Questions:问题:

Did the command range change somehow from 2020/21 to 2022?命令范围是否从 2020/21 到 2022 年发生了某种变化?

Is it the webdriver manager that prevents the options from being called?是阻止调用选项的 webdriver 管理器吗?

--headless should come with --window-size --headless 应该带有 --window-size

Ex: "--window-size=1920,1080"例如:“--window-size=1920,1080”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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