如何从表数据中选取特定的ID
我想从表中选择特定的 id,表有 10 行和 7 列,我正在使用 selenium rc 和 eclipse ide,当我运行下面的代码时,它给出以下错误,请告诉我任何一个
com.thoughtworks.selenium.SeleniumException: ERROR: Invalid target format. Correct format is tableName.rowNum.columnNum
int rowCount= selenium.getXpathCount("//table[@id='role']/tbody/tr/").intValue();
System.out.println("Row Count Is As " + rowCount);
int colCount= selenium.getXpathCount("//table[@id='role']/tbody/tr[1]/td").intValue();
System.out.println("Col Count Is As " + colCount);
String myInput = "3";
for(int j = 1; j<rowCount; j++)
{
String myroleID = selenium.getTable("//table[@id='role'].["+j+"].1");
if(myroleID.equals(myInput))
{
System.out.println("Given Input is in the Row:"+j);
}
}
I want pick the particular id from table, table have 10 rows and 7 columns,and i am using selenium rc and eclipse ide, when i ran below code its giving below error pls tell me any one
com.thoughtworks.selenium.SeleniumException: ERROR: Invalid target format. Correct format is tableName.rowNum.columnNum
int rowCount= selenium.getXpathCount("//table[@id='role']/tbody/tr/").intValue();
System.out.println("Row Count Is As " + rowCount);
int colCount= selenium.getXpathCount("//table[@id='role']/tbody/tr[1]/td").intValue();
System.out.println("Col Count Is As " + colCount);
String myInput = "3";
for(int j = 1; j<rowCount; j++)
{
String myroleID = selenium.getTable("//table[@id='role'].["+j+"].1");
if(myroleID.equals(myInput))
{
System.out.println("Given Input is in the Row:"+j);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你需要做的就是
让它发挥作用
what you need to do is
That should make it work