使用 selenium 的 chrome 驱动程序,我试图通过它的 id 从我的页面中选择一个元素,它是数字的(即 1000)。
这失败了,给出:
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
但是,如果我将 id 更改为不完全由数字组成的字符串(即 m1000),则选择有效。
知道为什么会这样吗?
最佳答案
好像是因为ID tokens must begin with a letter ([A-Za-z])
,见 http://w3.org/TR/html401/types.html#type-name
关于grails - 在 grails geb 中通过数字 id 进行选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13523881/