These error messages...
[14664:14280:0420/202509.245:ERROR:browser_switcher_service.cc(238)] XXX Init()
[14664:14280:0420/202509.678:ERROR:device_event_log_impl.cc(162)] [20:25:09.679] Bluetooth: bluetooth_adapter_winrt.cc:1186 Getting Radio failed. Chrome will be unable to change the power state by itself.
[14664:14280:0420/202509.695:ERROR:device_event_log_impl.cc(162)] [20:25:09.696] Bluetooth: bluetooth_adapter_winrt.cc:1264 OnPoweredRadioAdded(), Number of Powered Radios: 1
[14664:14280:0420/202509.696:ERROR:device_event_log_impl.cc(162)] [20:25:09.696] Bluetooth: bluetooth_adapter_winrt.cc:1283 OnPoweredRadiosEnumerated(), Number of Powered Radios: 1
...implies that the on_init_
method failed in std::make_unique<base::ScopedClosureRunner>(std::move(on_init))
.
Analysis
These errors are defined in bluetooth_adapter_winrt.cc as follows:
Getting Radio failed. Chrome will be unable to change the power state by itself:
void BluetoothAdapterWinrt::OnGetRadio(base::ScopedClosureRunner on_init,
ComPtr<IRadio> radio) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (radio) {
radio_ = std::move(radio);
radio_was_powered_ = GetState(radio_.Get()) == RadioState_On;
radio_state_changed_token_ = AddTypedEventHandler(
radio_.Get(), &IRadio::add_StateChanged,
base::BindRepeating(&BluetoothAdapterWinrt::OnRadioStateChanged,
weak_ptr_factory_.GetWeakPtr()));
if (!radio_state_changed_token_)
BLUETOOTH_LOG(ERROR) << "Adding Radio State Changed Handler failed.";
return;
}
// This happens within WoW64, due to an issue with non-native APIs.
BLUETOOTH_LOG(ERROR)
<< "Getting Radio failed. Chrome will be unable to change the power "
"state by itself.";
Number of Powered Radios: 1:
void BluetoothAdapterWinrt::OnPoweredRadioAdded(IDeviceWatcher* watcher,
IDeviceInformation* info) {
if (++num_powered_radios_ == 1)
NotifyAdapterPoweredChanged(true);
BLUETOOTH_LOG(ERROR) << "OnPoweredRadioAdded(), Number of Powered Radios: "
<< num_powered_radios_;
}
void BluetoothAdapterWinrt::OnPoweredRadioRemoved(
IDeviceWatcher* watcher,
IDeviceInformationUpdate* update) {
if (--num_powered_radios_ == 0)
NotifyAdapterPoweredChanged(false);
BLUETOOTH_LOG(ERROR) << "OnPoweredRadioRemoved(), Number of Powered Radios: "
<< num_powered_radios_;
}
void BluetoothAdapterWinrt::OnPoweredRadiosEnumerated(IDeviceWatcher* watcher,
IInspectable* object) {
BLUETOOTH_LOG(ERROR)
<< "OnPoweredRadiosEnumerated(), Number of Powered Radios: "
<< num_powered_radios_;
// Destroy the ScopedClosureRunner, triggering the contained Closure to be
// run. Note this may destroy |this|.
DCHECK(on_init_);
on_init_.reset();
}
Deep Dive
These errors are the direct impact of the changes incorporated with google-chrome as per the details within the discussion in Chrome no longer accepts certificates that fallback to common name
Solution
Ensure that:
- Selenium is upgraded to current levels Version 3.141.59.
- ChromeDriver is updated to current ChromeDriver v84.0 level.
- Chrome is updated to current Chrome Version 84.0 level. (as per ChromeDriver v84.0 release notes)
- If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Additional considerations
However it was observed that this error can be supressed by running Chrome as root
user (administrator
) on Linux, but that would be a deviation from the documentation in ChromeDriver - WebDriver for Chrome where it is mentioned:
A common cause for Chrome to crash during startup is running Chrome as root user (administrator) on Linux. While it is possible to work around this issue by passing '--no-sandbox' flag when creating your WebDriver session, i.e. the ChromeDriver session as such a configuration is unsupported and highly discouraged.
Ideally, you need to configure your environment to run Chrome as a regular user instead.
Suppressing the error
Finally, 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:\WebDrivers\chromedriver.exe')
driver.get("https://www.google.com/")