How to hide Chrome Driver in python?

Google announced in 4/2017 you can run in headless.

https://developers.google.com/web/updates/2017/04/headless-chrome

chrome_options = Options()
# Chrome v75 and lower:
# chrome_options.add_argument("--headless") 
# Chrome v 76 and above (v76 released July 30th 2019):
chrome_options.headless = True

chrome_options.binary_location = '/Applications/Google Chrome   Canary.app/Contents/MacOS/Google Chrome Canary'  
driver = webdriver.Chrome(executable_path=os.path.abspath(“chromedriver"),   chrome_options=chrome_options)

Few things you should make sure

  • If using Mac/Linux then chrome version should be minimum 59
  • If using Windows then chrome version should be minimum 60
  • Use the latest chromedriver as well to make sure you don't have compatibility issue

REF: how-could-i-start-a-selenium-browserlike-firefox-minimized

You can move browser window over the monitor, like this:

driver.set_window_position(-10000,0)