title: org.openqa.selenium.InvalidSelectorException: invalid selector while trying to locate an element
body: <p>My element is displayed as:</p>
  
  <pre><code>&lt;a class="main-item" href="#"&gt;Business Loans&lt;/a&gt;
  </code></pre>
  
  <p>xpath is:</p>
  
  <pre><code>//*[@id='main-nav']/ul/li[1]/a[1]']
  </code></pre>
  
  <p>This returns <code>invalid element locator</code></p>
  
  <pre><code>//*[@id='main-nav']/ul/li[1]/a']
  
  driver.findElement(By.xpath("//*[@id='main-nav']/ul/li[1]/a[1]']"))
  </code></pre>
  
  <p>I am trying to get the element.</p>