title: How to override Selenium Headless user agent for chrome?
body: <p>I have the following code</p>
  
  <pre><code>import sys
  from os import path
  import os
  import numpy as np
  import pandas as pd
  from bs4 import BeautifulSoup
  from selenium import webdriver
  from selenium.webdriver.chrome.options import Options
  
  class DDDDDD(object):
      def __init__(self, date=None, path_to_save=None, chomedriver_exe_path=None, pred=True):
          self.pred = pred
          if chomedriver_exe_path is None:
              home = os.path.expanduser('~')
              self.chomedriver_exe_path = home + '/Downloads/chromedriver.exe'
          else:
              self.chomedriver_exe_path = chomedriver_exe_path
          self.driver = None
  
      def setup_driver(self):
          user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36'
          chrome_options = Options()
          chrome_options.add_argument("headless") # --headless
          chrome_options.add_argument('--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36')
          chrome_options.add_argument("--window-size=1920x1080")
          chrome_driver = self.chomedriver_exe_path
          self.driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=chrome_driver)
          return self.driver
  
  
  ddddd = DDDDDD()
  ddddd.setup_driver()
  
  ddddd.driver.get("http://kluge.in-chemnitz.de/tools/browser.php")
  
  ddddd.driver.save_screenshot('browser.png')
  </code></pre>
  
  <p>I am trying to override the user agent so this particular site I am trying to visit a banking (automate personal transaction data downloads). I have tried the following solutions.</p>
  
  <p><a href="http://tarunlalwani.com/post/selenium-change-user-agent-different-browsers/" rel="nofollow noreferrer">source 1</a>
  <a href="https://intoli.com/blog/making-chrome-headless-undetectable/" rel="nofollow noreferrer">source 2</a></p>
  
  <p>None seem to work. The screenshot from a test site i used contains the word headless. Could someone help me do this for the chrome browser? Other browser solutions are definitely acceptable but I would prefer the chrome browser.</p>