【发布时间】:2013-11-20 14:19:05
【问题描述】:
我正在开发 Selenium 框架 2.0 Web 驱动程序,我想从具有数据自动化 ID 等属性的跨度中获取价值。 HTML代码如下
<span data-automation-id="SEL_ERR">
Error Description
</span>
现在我想读取具有属性 data-automation-id 设置为 SEL_ERR 的 in span 文本。
有人可以帮我修复代码吗,因为我已经尝试了下面的代码,但没有成功。
driver.findElement(By.tagName("span")).getAttribute("data-automation-id");
【问题讨论】:
标签: testing selenium selenium-webdriver automated-tests