I have problem with this that I want to have a clean terminal/output but when I use selenium in python and when I call :
driver = webdriver.Chrome()
I get this message between my output :
[14096:8964:1002/201524.623:ERROR:chrome_browser_main_extra_parts_metrics.cc(228)] crbug.com/1216328: Checking Bluetooth availability started. Please report if there is no report that this ends.
[14096:8964:1002/201524.623:ERROR:chrome_browser_main_extra_parts_metrics.cc(231)] crbug.com/1216328: Checking Bluetooth availability ended.
[14096:8964:1002/201524.632:ERROR:chrome_browser_main_extra_parts_metrics.cc(234)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends.
[14096:5428:1002/201524.633:ERROR:device_event_log_impl.cc(214)] [20:15:24.633] Bluetooth: bluetooth_adapter_winrt.cc:1073 Getting Default Adapter failed.
[14096:8964:1002/201524.660:ERROR:chrome_browser_main_extra_parts_metrics.cc(238)] crbug.com/1216328: Checking default browser status ended.
My code doesn't have any errors but I get this temp output How can I remove this output? any code I need to remove this?
CodePudding user response:
you can use playwright:
pip install --upgrade pip
pip install playwright
playwright install
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto("http://playwright.dev")
print(await page.title())
await browser.close()
asyncio.run(main())
This is the Docs of playwright
CodePudding user response:
If you are using Selenium with Python then add these extra options into your Selenium code which will disable all the errors getting displayed on Console-
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)