[英]Firefox Python selenium not going headless
I am trying to make firefox headless and doing exactly as shown in the documentation. 我试图使Firefox无头,并且完全按照文档中所示进行操作。
This shouldn't be doing what it is supposed to the firefox window is appearing even when I am adding the headless argument 即使当我添加无头参数时,这也不应该做应该做的事情,而Firefox窗口却出现了
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
options = webdriver.FirefoxOptions()
options.add_argument('-headless')
driver = webdriver.Firefox(firefox_options=options, capabilities=cap)
this should not open the firefox window but it opening the window 这不应该打开Firefox窗口,但是会打开窗口
I have never had this kind of problem with chrome and chromedriver
我从未遇到过chrome和chromedriver这样的问题
I have downloaded the 64-bit geckodriver binary and it is in PATH what am I doing wrong here? 我已经下载了64位geckodriver二进制文件,并且在PATH中我在这里做错了什么?
Try following code block: 尝试以下代码块:
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
You need to use Options()
not webdriver.FirefoxOptions()
: 您需要使用
Options()
而不是webdriver.FirefoxOptions()
:
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument('--headless')
Hope this helps you! 希望这对您有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.