2

Recently every time I run any BDD test, I seem to be getting the following error in command line-

running on chrome driver: 73/74.0.3729.6 and chrome 73

[17996:17852:0502/103000.545:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DnsPrefetchingEnabled [17996:17852:0502/103000.741:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DnsPrefetchingEnabled

After that the command line stays open and chrome opens for few seconds closes and opens a new command line it does this around 5+ times.

I have tried the following thread -

Failed to read HKLM\SOFTWARE\Policies\Google\Chrome\MachineLevelUserCloudPolicyEnrollmentToken: The system cannot find the file specified. (0x2)

but that just seemed to create more issues. I've tried and updated the chrome driver to 73 and 74 but that did not fix the issue.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

2 Answers2

0

This error message...

[17996:17852:0502/103000.741:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DnsPrefetchingEnabled

...implies that the ChromeDriver was unable to communicate with the WebBrowser i.e. Chrome Browser.

Some information about your Test Environment and the Binary versions you are using would have helped us to debug the issue in a better way. However an easy solution seems to be using the switch --dns-prefetch-disable through an instance of ChromeOptions as follows:

  • Details:

    --dns-prefetch-disable
    
    Disables prefetching of DNS information.
    
    This switch was listed in chrome/common/chrome_switches.cc
    Removed on 2014-11-14
    
  • Sample Code:

    'chromeOptions': { 
      'args': ['--DNS-prefetch-disable']
    }
    

DNS Prefetching

DNS resolution time can lead to a significant amount of user perceived latency. The time that DNS resolution takes is highly variable. Latency delays range from around 1ms (locally cached results) to commonly reported times of several seconds.

DNS Prefetching is an attempt to resolve domain names before a user tries to follow a link. This is done using the computer's normal DNS resolution mechanism; no connection to Google is used. Once a domain name has been resolved, if the user does navigate to that domain, there will be no effective delay due to DNS resolution time. The most obvious example where DNS prefetching can help is when a user is looking at a page with many links to various domains, such as a search results page. When we encounter hyperlinks in pages, we extract the domain name from each one and resolving each domain to an IP address. All this work is done in parallel with the user's reading of the page, using minimal CPU and network resources. When a user clicks on any of these pre-resolved names, they will on average save about 200 milliseconds in their navigation (assuming the user hadn't already visited the domain recently). More importantly than the average savings, users won't tend to experience the "worst case" delays for DNS resolution, which are regularly over 1 second.


BuiltInDnsClientEnabled

  • BuiltInDnsClientEnabled: Uses the built-in DNS client.

    Data type:
        Boolean [Windows:REG_DWORD]
    
    Windows registry location for Windows clients:
        Software\Policies\Google\Chrome\BuiltInDnsClientEnabled
    
    Mac/Linux preference name:
        BuiltInDnsClientEnabled
    
    Supported on:
        Google Chrome (Linux, Mac, Windows) since version 25
    
    Supported features:
        Dynamic Policy Refresh: Yes, Per Profile: No
    
    Description:
        Controls whether the built-in DNS client is used in Google Chrome.
    
        If this policy is set to true, the built-in DNS client will be used, if available.
    
        If this policy is set to false, the built-in DNS client will never be used.
    
        If this policy is left not set, the built-in DNS client will be enabled by default on MacOS, Android (when neither Private DNS nor VPN are enabled) and ChromeOS, and the users will be able to change whether the built-in DNS client is used by editing chrome://flags or specifying a command-line flag.
    
    Example value:
        0x00000001 (Windows), true (Linux), <true /> (Mac)
    

tl; dr

  • Both Chromium and Google Chrome support the same set of policies. Please note that this answer may include unreleased policies which are subject to change or removal without notice and for which no guarantees of any kind are provided, including no guarantees with respect to their security and privacy properties.
  • These policies are strictly intended to be used to configure instances of Google Chrome internal to your organization. Use of these policies outside of your organization (for example, in a publicly distributed program) is considered malware and will likely be labeled as malware by Google and anti-virus vendors.
  • These settings don't need to be configured manually! Easy-to-use templates for Windows, Mac and Linux are available for download from https://www.chromium.org/administrators/policy-templates.
  • Last updated on 2019-04-24 based on Chrome 76.0.3776.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thanks for the excellent detail in this answer but i cannot seem to find any settings that we use, This seems to just be affecting my testing environment, Could this be related to something else as i do not have the permissions to modify the chrome policies directly but DNSPreFetching does show as unknown policy. – SomeGuyInternet May 02 '19 at 14:27
  • @SomeGuyInternet You just need to add the argument through `ChromrOptions` and execute your testcase – undetected Selenium May 02 '19 at 16:05
  • @SomeGuyInternet If adding the `ChromeOptions` doesn't solves your issue, you need to add the _Registry Key_ and execute your testcase. – undetected Selenium May 02 '19 at 16:07
  • i have added it to my startup arguments but the error still seems to show up. When you mean add it to registry could you explain how please? – SomeGuyInternet May 03 '19 at 08:40
0

Mine worked after I re-downloaded matching ChromeDriver. Apparently, the driver I'm using no longer support my browser after I updated it.

ChromeDriver has different versions, and it should match your current Chrome browser version.

ie. my current browser is version 77 so I had to download ChromeDriver for version 77