强文本我试图使用 pagefactory 处理 POM 中的 webtable 但它的抛出错误
如果我尝试直接粘贴 xpath,否则它不起作用
@FindBy (xpath = "//table[@id='userTable']/tbody/tr[")
WebElement before_xpath;
@FindBy (xpath = "]/td[2]")
WebElement after_xpath;
@FindBy (xpath = "//table[@id='userTable']/tbody/tr")
List<WebElement> namelist;
//Intialising PageObjects
public users_page() {
PageFactory.initElements(driver, this);
}
//Actions
public void userlist(String nm, String un, String pw, String cpw, String hub) {
List<WebElement> row =namelist;
int row_count = row.size();
System.out.println("Total no of rows " +row_count);
for(int i=1;i<row_count;i++) {
WebElement actual_xpath = before_xpath +i +actual_xpath;
System.out.println("Total " +actual_xpath);
}
}}
它在 WebElement actual_xpath = before_xpath +i +actual_xpath; 上引发错误。
其显示 运算符 + 未定义参数类型 WebElement, int
所以我可以处理这个