考虑我有一个网表与类名的消息表和具有表里面的数据下面的列表项(TD)如何从selenium webdriver中的表数据获取列表项值?
<td>
<ul class="error">
<li class="ng-binding ng-scope" ng-repeat="error in errors">Validation1</li>
<li class="ng-binding ng-scope" ng-repeat="error in errors">Validation2</li>
<li class="ng-binding ng-scope" ng-repeat="error in errors">Validation3</li>
</ul>
</td>
我需要阅读从网络上述所有内容(Validation1,Validation2,Validation3)页面,并需要根据预期的验证消息进行验证。
你能帮我解决这个情况吗?
为什么不创建一个列表''收集,然后通过它旋转? –
Brian
哪种语言? –
谢谢Brian。我已经使用列表集合,它正在工作很好实现我的方案WebElement table = driver.findElement(By.className(“messageTable”)); 列表 rows = table.findElements(By.tagName(“li”)); \t \t \t \t \t \t \t \t 为(WebElement元件:行){ \t \t \t \t \t \t \t的System.out.println(element.getText()); \t \t} –
Subburaj