title: InvalidSelectorException using CSS selector to locate "data-" attribute notated elements
body: <h2>Motivation</h2>
  
  <p>To utilize Selenium's CSS selector mechanism alongside with CSS attribute selectors and the HTML5 <code>data-</code> custom attribute to address specific hooks for elements.</p>
  
  <h2>Issue</h2>
  
  <p>While using the above to locate an element assigned with a CSS classname and the <code>data-</code> attribute, the following exception is thrown:</p>
  
  <pre><code>Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: The given selector .gs-a-btn["data-value"] is either invalid or does not result in a WebElement. The following error occurred:
  [Exception... "An invalid or illegal string was specified"  code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)"  location: "file:///C:/DOCUME~1/eliranm/LOCALS~1/Temp/anonymous6109849275533680625webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js Line: 5956"]
  Build info: version: '2.23.1', revision: '17143', time: '2012-06-08 18:59:28'
  System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_31'
  Driver info: driver.version: unknown
      at &lt;anonymous class&gt;.&lt;anonymous method&gt;(file:///C:/DOCUME~1/eliranm/LOCALS~1/Temp/anonymous6109849275533680625webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:6537)
  </code></pre>
  
  <h2>Relevant Code</h2>
  
  <pre class="lang-java prettyprint-override"><code>public void previous(String type) {
      By cssSelector = By.cssSelector(".gs-a-btn[data-value='" + type + "']");
      driver.findElement(cssSelector).click();
  }
  </code></pre>
  
  <h2>What have I tried</h2>
  
  <ul>
  <li>replacing single quotes with escaped double quotes inside the attribute selector query.</li>
  <li>specifying attribute selector instead of attribute-value selector, i.e. <code>".gs-a-btn[\"data-value\"]"</code> rather <code>".gs-a-btn[data-value='" + type + "']"</code>.</li>
  <li><p>to look up information in references, such as the <a href="http://release.seleniumhq.org/selenium-core/1.0/reference.html">Selenium Reference</a>, for any restrictions on CSS attribute selectors. the document specifically states that:</p>
  
  <blockquote>
    <p>Currently the css selector locator supports all css1, css2 and css3
    selectors except namespace in css3, some pseudo classes(<code>:nth-of-type</code>,
    <code>:nth-last-of-type</code>, <code>:first-of-type</code>, <code>:last-of-type</code>, <code>:only-of-type</code>,
    <code>:visited</code>, <code>:hover</code>, <code>:active</code>, <code>:focus</code>, <code>:indeterminate</code>) and pseudo
    elements(<code>::first-line</code>, <code>::first-letter</code>, <code>::selection</code>, <code>::before</code>,
    <code>::after</code>).</p>
  </blockquote></li>
  </ul>