- 1 year ago
Supress output of chromedriver
Comment
1 / 1
To suppress the output of chromedriver
in Python, you can redirect the output to os.devnull
. This way, the output will be discarded and not displayed in the console. Here's an example:
pythonimport os
from selenium import webdriver
# Configure ChromeDriver options
options = webdriver.ChromeOptions()
options.add_argument('--silent') # Suppress ChromeDriver output
# Redirect ChromeDriver output to os.devnull
options.add_argument('--log-path={}'.format(os.devnull))
# Start the ChromeDriver instance
driver = webdriver.Chrome(options=options)
# Rest of your code...
# Close the ChromeDriver instance
driver.quit()
In this example, the --silent
argument is added to the ChromeOptions
object to suppress chromedriver
output. Additionally, the --log-path
argument is set to os.devnull
, which is a special file in Python that discards any data written to it.
By using these options, you can run chromedriver
with suppressed output in your Python script.