我一直没能找到这个问题的答案。
这个特定的答案只是告诉我们可以重新定位它。
How do I relocate/disable GeckoDriver's log file in selenium, python 3?
有没有办法永久禁用它?
最佳答案
回答这个问题有点晚了,但我刚才也有同样的问题。我找到了隐藏在 this issue 中的解决方案在他们的 Github 存储库上。要更改日志的目标,您可以使用
import os
from selenium import webdriver
# to create a driver with no log
driver = webdriver.Firefox(service_log_path=os.devnull)
# or to just rename the log file
driver = webdriver.Firefox(service_log_path='my-app.log')
最初,当我使用关键字参数 log_path
(如问题中建议的那样)时,我收到了弃用警告,但这会因您使用的版本而异。我正在使用 selenium==3.141.0
。
关于python - 如何禁用 Selenium (Python 3) 上的 geckodriver 日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50960539/