Search code examples
grailsseleniumgebselenium-chromedriver

Selecting by a numeric id in grails geb


Using the chrome driver for selenium, I'm trying to select an element from my page by its id, which is numerical (ie 1000).

This fails, giving:

org.openqa.selenium.InvalidElementStateException: findElements execution failed;
 SYNTAX_ERR: DOM Exception 12 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 13 milliseconds
Build info: version: '2.2.1', revision: '16551', time: '2012-04-11 21:42:35'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-33-generic', java.version: '1.7.0_09'
Driver info: driver.version: RemoteWebDriver

However, if I change the id to be some string that is composed not exclusively by numbers (ie m1000), the selection works.

Any idea why this is happening?


Solution

  • Seems that it's because ID tokens must begin with a letter ([A-Za-z]), see http://w3.org/TR/html401/types.html#type-name