How to make Firefox headless programmatically in Selenium with Python?

后端 未结 6 1006
面向向阳花
面向向阳花 2020-11-22 11:37

I am running this code with python, selenium, and firefox but still get \'head\' version of firefox:

binary = FirefoxBinary(\'C:\\\\Program Files (x86)\\\\Mo         


        
6条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 12:09

    To the OP or anyone currently interested, here's the section of code that's worked for me with firefox currently:

    opt = webdriver.FirefoxOptions()
    opt.add_argument('-headless')
    ffox_driver = webdriver.Firefox(executable_path='\path\to\geckodriver', options=opt)
    

提交回复
热议问题