gpt4 book ai didi

python - 更改 Geckodriver for Python Selenium 的日志级别

转载 作者:太空宇宙 更新时间:2023-11-03 15:56:02 24 4
gpt4 key购买 nike

似乎 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_capabilitiesservice_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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com