title: Headless mode in chrome cant find elements on python
body: <p>For some reason when I try to run a Headless Chrome it gives me a no such element error. edit: keep in mind that I using a proxy that automatically goes through a login page for an app before rendering cnn.com. </p>
  
  <pre><code>def start_test(proxyHostInput, port):
      chrome_options = webdriver.ChromeOptions()
      chrome_options.add_argument('--incognito')
      chrome_options.add_argument('--proxy-server=%s' % proxyHostInput + port)
      chrome_options.add_argument('--headless')
      chrome_options.add_argument("--window-size=1366x768")
      chrome_options.add_argument('--disable-gpu')
      chrome_options.add_argument('--remote-debugging-port=3129')
      chromeDriver = r"C:\Users\Surfcrew\Downloads\chromedriver_win32\chromedriver.exe"
      browser = webdriver.Chrome(chromeDriver, chrome_options=chrome_options)
      browser.get('https://www.cnn.com/')
  
      try:
          # insert username
          username = browser.find_element_by_id("login_username")
          username.send_keys("REDACTED")
          browser.find_element_by_xpath("/html/body[@class='login_body ']/div[@class='topdiv']/div[@id='bar']/span"
                                        "[@id='login_name']/form[@class='form saml']/input[@class='button']").click()
          time.sleep(3)
          password = browser.find_element_by_xpath("/html/body[@class='login_body ']/div[@class='topdiv']/div[@id='bar']"
                                                   "/span[@id='login_password']/form[@class='form password']"
                                                   "/div[@class='formdiv']"
                                                   "/input[@id='password']")
  
          # insert pass
          password.send_keys(readacted)
          browser.find_element_by_xpath("/html/body[@class='login_body ']/div[@class='topdiv']/div[@id='bar']"
                                        "/span[@id='login_password']/form[@class='form password']"
                                        "/input[@id='password_submit']").click()
  </code></pre>
  
  <p>but I am still getting this error: </p>
  
  <pre><code>Message: no such element: Unable to locate element: {"method":"id","selector":"login_username"}
    (Session info: headless chrome=68.0.3440.106)
    (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)
  </code></pre>
  
  <p>Can somebody explain why or how to solve this?</p>