title: Selenium WebDriver findElements() Fails on Single Quotes
body: <p>My goal is to parse a block of HTML code like below to obtain the text, comments and replies fields as separate parts of the block: </p>
  
  <pre><code>&lt;div id='fooID' class='foo'&gt;
  &lt;p&gt;
      This is the top caption of picture's description&lt;/p&gt;
  &lt;p&gt;
      T=&lt;img src="http://www.mysite.com/images/img23.jpg" alt="" width="64" height="108"/&gt;       &lt;/p&gt;
  &lt;p&gt;
      And here is more text to describe the photo.&lt;/p&gt; 
  &lt;div class=comments&gt;(3 comments)&lt;/div&gt;
  &lt;div id='reply13' class='replies'&gt;
     &lt;a href=javascript:getReply('13',1)&gt;Show reply &lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My problem is that Selenium's WebDriver does not seem to support non-string identifiers in the HTML (notice that the class field in the HTML is 'foo' and as opposed to "foo"). From all examples that I have seen in both the Selenium docs and in other SO posts, the latter format is what WebDriver commonly expects. </p>
  
  <p>Here is the relevant part of my Java code with my various (unsuccessful) attempts:</p>
  
  <pre><code>java.util.List&lt;WebElement&gt; elementList =    driver.findElements(By.xpath("//div[@class='foo']"));
  java.util.List&lt;WebElement&gt; elementList = (List&lt;WebElement&gt;)  ((JavascriptExecutor)driver).executeScript("return $('.foo')[0]");
  java.util.List&lt;WebElement&gt; elementList = driver.findElements(By.xpath("//div[contains(@class, 'foo')]"));
  java.util.List&lt;WebElement&gt; elementList = driver.findElements(By.cssSelector("div." + foo_tag)); // where foo_tag = "'foo'".replace("'", "\'");
  java.util.List&lt;WebElement&gt; elementList = driver.findElements(By.cssSelector("'foo'"));
  </code></pre>
  
  <p>Is there a sure way of handling this? Or is there an alternative, better way of extracting the above fields?
  Other info:</p>
  
  <ol>
  <li>I'm an HTML noob, but have made efforts to understand the structure of the HTML code/tags</li>
  <li>Using Firefox (and, accordingly, FirefoxDriver)</li>
  </ol>
  
  <p>Your help/suggestions greatly appreciated!</p>