Environment: Python 3.5.x + Selenium 3.4.3 + chromedriver 2.30 + Chrome Beta + win7/win10
Chrome_options = Webdriver. Chromeoptions () chrome_options.add_argument ('--headless'= webdriver. Chrome (chrome_options=chrome_options)
The code is simple, but the environment to emphasize that the latest version of Chrome is 59,MAC and Linux version has supported no interface browsing, but Windows will have to wait until July to release the 60 version, but now can download 60 beta version, tested is available, The following is a description of the official link:
Https://developers.google.com/web/updates/2017/04/headless-chrome
Chrome Beta: Http://www.chromium.org/getting-involved/dev-channel/Beta channel for Windows (64-bit) or Beta channel For Windows (32-bit)
Current beta does not automatically close chrome when the Python main process exits, consider Chrome Canary, Chrome Canary has no interface mode, Chrome Canary has less memory than chrome.
If you call Chrome Canary, you can specify the path to Chrome's run file and call it to Chrome Canary correctly:
chrome_options.binary_location = ' C:/users/roy/appdata/local/google/chrome sxs/application/chrome.exe '
Chrome turns on no-interface browsing mode python+windows environment