title: Getting Error in Headless Chrome driver in Selenium C#
body: <p>I am getting error using Headless chrome driver in Selenium C# . I am doing automation the website which involve the User Name and password. It is doing good without Headless chrome. But when I used the headless chrome . Its mostly giving me the error </p>
  
  <pre><code>{"no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\"
  </code></pre>
  
  <h1>current-portfolio-collapsible > div > div > div > table > tbody > tr:nth-child(6) > td:nth-child(1) > div > a > span\"}\n</h1>
  
  <p>(Session info: headless chrome=64.0.3282.167..<code>enter code here</code></p>
  
  <p>I am getting this error in Headless chrome only. Below is the Code .</p>
  
  <pre><code> var driverService = ChromeDriverService.CreateDefaultService();
              driverService.HideCommandPromptWindow = true;
                 ChromeOptions option = new ChromeOptions();
                  option.AddArgument("--headless");
                  option.AddArgument("--window-size=2160,3840");
              using (var driver = new ChromeDriver(driverService, option))
              {
                  WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
                  driver.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(2);
                  driver.Navigate().GoToUrl("https://www.wikifolio.com/");
                  label1.Text = "Browser is opened now";                
                      try
                      {
  
                          driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMinutes(2);
                          IJavaScriptExecutor main = (IJavaScriptExecutor)driver;
                          Task.Delay(10000);
  
                      main.ExecuteScript("arguments[0].click();", driver.FindElement(By.XPath("//*[@id=\"page-content\"]/header/div[2]/div/div/nav/div[2]/a[1]")));
  
                      driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
                          var username = driver.FindElement(By.CssSelector("input#Username"));
                          username.SendKeys("derhenker55@hotmail.com");
  
                          driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
  
                          var password = driver.FindElement(By.CssSelector("input#Password"));
                          Task.Delay(1000);
                          password.SendKeys("password");
                          driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
  
                          IJavaScriptExecutor loginclick = (IJavaScriptExecutor)driver;
                      Task.Delay(1000);
                      loginclick.ExecuteScript("arguments[0].click();", driver.FindElement(By.CssSelector("form &gt; button.c-button")));
  
                      }
                      catch(Exception e)
                      {
                      }
  
  
              }
  </code></pre>
  
  <p>And this is the website.</p>
  
  <p><a href="https://www.wikifolio.com/" rel="nofollow noreferrer">https://www.wikifolio.com/</a></p>
  
  <p>Here you can find the top right corner "Login" Button.</p>
  
  <p>Please help me in this regard. Help will be highly appreciated. Thanks</p>