title: Selenium xpath syntax incorrect
body: <p>I am trying to create ajax wait method in Java with Selenium for fetching as many results as defined by configuration.</p>
  
  <p>Here is my method:</p>
  
  <pre><code>    /**
       * Wait for WAIT seconds for AJAX data to be loaded.
       * @throws Exception - if thread is interrupted
       */
      public List&lt;WebElement&gt; waitAjaxLoad(By by) throws Exception{
          int ajaxResultsWait = Integer.parseInt(P.getProperty("ajax.results.wait"));
          List&lt;WebElement&gt; resultsLoaded = null;
  
          do{
              resultsLoaded = driver.findElements(by);
          }while(resultsLoaded.size() &lt; ajaxResultsWait);
          return resultsLoaded;
      }
  </code></pre>
  
  <p>And here is my call:</p>
  
  <pre><code>List&lt;WebElement&gt; videoElements = waitAjaxLoad(By.xpath("//div[@id='pageTv']/div[@id='pageTvScroller')]/div[@class='boxInner']/ul/li"));
  </code></pre>
  
  <p>And I get this exception:</p>
  
  <blockquote>
    <p>org.openqa.selenium.InvalidSelectorException: The given selector
    //div[@id='pageTv']/div[@id='pageTvScroller')]/div[@class='boxInner']/ul/li
    is either invalid or does not result in a WebElement. The following
    error occurred: InvalidSelectorError: Unable to locate an element with
    the xpath expression
    //div[@id='pageTv']/div[@id='pageTvScroller')]/div[@class='boxInner']/ul/li
    because of the following error: [Exception... "The expression is not a
    legal expression."  code: "12" nsresult: "0x805b0033 (SyntaxError)" 
    location: ""] Command duration or timeout: 20 milliseconds</p>
  </blockquote>
  
  <p>Should I wory about XPath expression not being snytax correct, or Selenium can't find that WebElement? This exception is ambiguous to me....</p>