简体   繁体   English

如何在Selenium(Python 3)上禁用geckodriver的日志?

[英]How do I disable geckodriver's log on Selenium (Python 3)?

I have not been able to find the answer to this. 我还没有找到答案。

This particular answer only tells we can relocate it. 这个特定的答案仅告诉我们可以重新放置它。

How do I relocate/disable GeckoDriver's log file in selenium, python 3? 我如何在硒python 3中重新定位/禁用GeckoDriver的日志文件?

Is there no way to permanently disable it? 有没有办法永久禁用它?

A little late to answer this, but I had the same question just now. 回答这个问题有点晚了,但是我刚才有同样的问题。 I found the solution buried in this issue on their Github repository. 我在他们的Github存储库中找到了解决该问题的方法 To change the target of the log you can use 要更改日志目标,可以使用

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')

Initially I got a deprecation warning when I used the keyword argument log_path (as suggested in the issue) but that will vary on the version you're using. 最初,当我使用关键字参数log_path (如问题中所建议的那样),我收到了弃用警告,但该警告因所使用的版本而异。 I'm using selenium==3.141.0 . 我正在使用selenium==3.141.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM