使用selenium webdriver在Webtable列中插入值的任何示例

时间:2015-04-03 18:42:59

标签: selenium

我有infragistics web表,我可以获取计数但不能插入值。请提供一些这方面的例子。

WebElement Webtable = driver.findElement(By.id(&#34; x:1855522105.5:mkr:dataTbl.hdn&#34;)); //将TableID替换为实际表ID或Xpath     List TotalRowCount = Webtable.findElements(By.xpath(&#34; // table [@id =&#39; x:1855522105.5:mkr:dataTbl.hdn&#39;] / tbody / tr&#34;)); < / p>

System.out.println("No. of Rows in the WebTable: "+TotalRowCount.size());
// Now we will Iterate the Table and print the Values   
int RowIndex=1;
for(WebElement rowElement:TotalRowCount)
{
      List<WebElement> TotalColumnCount=rowElement.findElements(By.xpath("td"));
      int ColumnIndex=1;
      for(WebElement colElement:TotalColumnCount)
      {
           System.out.println("Row "+RowIndex+" Column "+ColumnIndex+" Data "+colElement.getText());
           ColumnIndex=ColumnIndex+1;
       }
      RowIndex=RowIndex+1;
 }

}

0 个答案:

没有答案