title: Not able to locate element when running chrome in headless mode
body: <p>@DebanjanB - Hello. I have automated the download of a website using selenium chrome driver. However when I run chrome in headless mode, it is not able to locate the checkbox which is to be clicked to download the file. Can you help me figure out this problem?</p>
  
  <p>Below is my code :</p>
  
  <pre><code>import org.openqa.selenium.chrome.ChromeOptions
  import org.openqa.selenium.chrome.ChromeDriver
  import org.openqa.selenium.By
  import scala.collection.mutable.HashMap
  
  object selen extends App{
  
    val chromeOptions = new ChromeOptions()
    chromeOptions.addArguments("--headless")
    new ChromeDriver(chromeOptions)
    val driver = new ChromeDriver(chromeOptions)
  
    driver.get("url")
  
    driver.findElement(By.id("isc_S")).sendKeys("Username")
    driver.findElement(By.id("isc_V")).sendKeys("Password")
    driver.findElement(By.id("isc_Z")).click
    println("Logged in")
  
    driver.manage.window.maximize
    Thread.sleep(5000);
  
    driver.findElement(By.cssSelector("#isc_36 &gt; table &gt; tbody &gt; tr &gt; td")).click()
    println("clicked Dashboard")
    Thread.sleep(5000);
  
    var count = 1
  
    for (i &lt;- 1 to 9) {
      for (j &lt;- 1 to 5) {
        driver.findElement(By.xpath("//*[@id=\"isc_5Ptable\"]/tbody/tr[" + count + "]/td[1]/div/span")).click()
        driver.findElement(By.id("isc_64")).click()
        Thread.sleep(4000)
        driver.findElement(By.xpath("//*[@id=\"isc_5Ptable\"]/tbody/tr[" + count + "]/td[1]/div/span")).click()
        count+=1
      }
  
      var count2 = 10
      while(count2 &gt; 0)
      {
        driver.findElement(By.xpath("//*[@id=\"isc_5Q\"]/img[3]")).click()
        count2 -= 1
      }
    }
    driver.close()
  }
  </code></pre>
  
  <p>Below is the html of the checkbox which is not being located in headless chrome driver:</p>
  
  <p>span style="display:inline-block;background-size:100% 100%;background-image:url(&quot;<a href="https://ford-ddlive.clifford-thames.com/datadistribution/sc/skins/ford/images/DynamicForm/unchecked.png&quot;);width:13px;height:13px;vertical-align:text-top;margin-left:2px;margin-right:2px" rel="nofollow noreferrer">https://ford-ddlive.clifford-thames.com/datadistribution/sc/skins/ford/images/DynamicForm/unchecked.png&quot;);width:13px;height:13px;vertical-align:text-top;margin-left:2px;margin-right:2px</a>" eventpart="valueicon">