似乎 Selenium 3.0
及更高版本需要 geckodriver
以及 Python 2.7 下的 Firefox,我现在已经安装了它。但是,似乎现在使用 Firefox 运行 Selenium 会自动在运行 Python 脚本的目录中创建文件 geckodriver.log
。
我想阻止这一切发生。我查看了各种 Github 线程以寻找答案,但找不到适用于 Firefox for Python 的任何内容。我在 geckodriver --help
中可以找到的是将日志级别设置为以下任何一项:
--log <LEVEL> Set Gecko log level [values: fatal, error, warn, info, config, debug, trace]
但是,我不确定该怎么做。也许对 webdriver.Firefox()
使用 desired_capabilities
或 service_args
之类的东西?
最佳答案
这对我有用 icw geckodriver 0.19.1
from selenium.webdriver.firefox.options import Options
opties = Options()
opties.log.level = 'trace'
browser = webdriver.Firefox(options=opties)
关于python - 更改 Geckodriver for Python Selenium 的日志级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43102811/