I'm trying to run a Python script using Selenium, and while everything runs fine, my personal print() to console lines get hidden between a ton of Selenium/Chromedriver outputs like this:
1128/150256.806:INFO:CONSOLE(0)] "The SSL certificate used to load resources from [some-link.com] will be distrusted in the future. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.", source: [current-page.com] (0)
I checked what these links are, and they're just the ads on the pages I'm looking at, so it's completely useless. Also, since the ads are randomly generated every time a page loads/is reloaded, the links are different so the outputs are never-ending. This is incredibly annoying and makes it very hard to see what is actually happening within my program. Is there any way to turn this off with some Selenium options or something?
The strange thing is, running the program in Eclipse Oxygen with PyDev doesn't show any of Selenium's output at all, only if I run it using command line.
EDIT: following the instructions from the possible duplicate mentioned didn't help. I tried setting the logging level to the highest, CRITICAL, and the output mentioned above still went through and flooded the console.
Set the browserstack. seleniumLogs capability to false to disable Selenium logs. A string. Defaults to true .
You can kill using below code: Runtime. getRuntime(). exec("taskkill /F /IM ChromeDriver.exe")
quit methods which are used to close a browser in Selenium. driver. close() and driver. quit() are two methods for closing a browser session in Selenium WebDriver.
The best Way to solve this problem is to add the --log-level option to your Driver. That would look something like this:
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--log-level=3")
driver = webdriver.Chrome(chrome_options=chrome_options)
Whoever uses the ChromeDriverManager via the webdriver_manager package can use the following to disable the [WDM] log messages:
import os
os.environ["WDM_LOG_LEVEL"] = str(logging.WARNING)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With