I’m getting this error when I try to run my selenium test:
[9680:18428:0605/111414.227:ERROR:device_event_log_impl.cc(214)] [11:14:14.228] Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed.
This is how my `conftest.py` file looks like:
Code
import pytest from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC options = webdriver.ChromeOptions() driver = webdriver.Chrome(options = options, service=Service(ChromeDriverManager().install())) Facebook = "https://facebook.com" wait = WebDriverWait(driver, timeout=60) @pytest.fixture def set_up(): driver.maximize_window() driver.get(Facebook)
As you can see I’m trying to make tests for Facebook using Google Chrome, but for some reason I get the mentioned error, does anyone know how to fix this
Advertisement
Answer
You can Suppress this error by using below.
As per the documentation in Selenium Chrome Driver: Resolve Error Messages Regarding Registry Keys and Experimental Options these error logs can be supressed by adding the argument:
excludeSwitches: ['enable-logging']
So your effective code block will be:
from selenium import webdriver options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ["enable-logging"]) driver = webdriver.Chrome(options=options, executable_path=r'C:WebDriverschromedriver.exe') driver.get("https://www.google.com/")