考慮我有一個網表與類名的消息表和具有表裏面的數據下面的列表項(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