grails - 在 grails geb 中通过数字 id 进行选择

标签 grails selenium geb selenium-chromedriver

使用 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/

相关文章:

linux - 使用 docker 启动集线器后出现 "This site can’ t be returned

selenium - 通过 Xpath 获取元素 (Geb)

groovy - Geb配置

testing - 如何使用 groovy 在 geb 中选择组合框

grails - 如何在自己的Grails脚本中使用非交互模式?

java - 在 JSP/GSP 中显示结果集

javascript - 如何在 selenium-webdriver nodejs land 中更改 selenium 用户代理?

css - Selenium IDE - 选择表行上的复选框

grails View 中未知数量的模型对象

grails - 如何在GRAILS 3中生成EAR文件?