dToday’s post is about a few error messages I countered while developing a framework with Selenium Web Driver with chrome.
I have been seeing the messageDevTools listening on ws://127.0.0.1:65055/devtools/browser/83f5addd-aadf-4882-839c-13f0d75604ac
For quite some time, but could not find any clue, and since it was not preventing my tests from running, I decided to leave it. I later learnt it might be due to the version of my chrome driver mismatching with my chrome browser.
You can find a list of available Chrome driver and the version of the Chrome browser version each version supports on its official site.
I took steps to resolve this issue, by first upgrading chrome browser to version 81.0 (the latest version as of this writing on May 15, 2020). I then start to see more (error) messages shown below:
1 2 3 4 5 6 |
[15304:22112:0513/223128.272:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: MachineLevelUserCloudPolicyEnrollmentToken [15304:22112:0513/223128.395:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: MachineLevelUserCloudPolicyEnrollmentToken DevTools listening on ws://127.0.0.1:65055/devtools/browser/83f5addd-aadf-4882-839c-13f0d75604ac [15304:22112:0513/223128.597:ERROR:browser_switcher_service.cc(238)] XXX Init() [15304:22112:0513/223132.052:ERROR:device_event_log_impl.cc(162)] [22:31:32.052] Bluetooth: bluetooth_adapter_winrt.cc:1055 Getting Default Adapter failed. |
I then updated the Chrome driver via NPM since I am using node (more about the package can be found here):
1 |
npm install chromedriver@81 -S |
To my surprise, by doing so none of the above error messages were resolved. It is more than what I have thought of at the first place.
The error messages fall into 2 groups, some unrecognized registry key (The first two messages)and another group of error messages (The last three messages) which seems rather strange.
Checking the windows registry by win + R, then regedit, there is indeed a key exists at
1 |
HKLM\SOFTWARE\Policies\Google\Chrome\MachineLevelUserCloudPolicyEnrollmentToken |
A lot of people have mentioned about add this key, however by already having this key, and the error message is indicating it is not known, I have decided to remove this key from the registry. And by doing so the first two error messages have been successfully resolved.
I later learnt from digging around in google, to resolve the other three error messages, chrome options excludeSwitches: ['enable-logging']
need to be introduced:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
const chromeCapabilities = selenium.Capabilities.chrome(); // Disable the info bar that says "Chrome is controlled by an automated testing software" const chromeArgs = [ '--disable-infobars', '--ignore-ssl-errors=yes', '--ignore-certificate-errors', ]; if (headless === true) { chromeArgs.push('--headless'); } const chromeOptions = { args: chromeArgs, excludeSwitches: ['enable-logging'], }; chromeCapabilities.set('chromeOptions', chromeOptions); this.Builder = new selenium.Builder() .withCapabilities(chromeCapabilities); this.driver = this.Builder.build(); |
For a list of available chrome driver options, see here