Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

Is there no way to permanently disable it?

like image 884
sky_lynx Avatar asked Jun 21 '18 04:06

sky_lynx


1 Answers

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. 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. I'm using selenium==3.141.0.

like image 170
Andrew F Avatar answered Sep 20 '22 02:09

Andrew F