[英]IF condition not working in Java Selenium
What is wrong with the if
-condition below? 下面的
if
-condition有什么问题? When both strings have same value, it is not going inside if
-condition. 当两个字符串具有相同的值时,它不会进入
if
-condition。
for(int j=0; j<types; j++){
List<WebElement> category = driver.findElements(By.xpath("//li[@class='pure-menu-selected']"));
for(int k=0; k<category.size(); k++){
String matchtype_from_excel = tours.getRow(x).getCell(j).getStringCellValue().toUpperCase().trim();
String matchtype_from_entry = driver.findElement(By.xpath("//li[@class='pure-menu-selected']["+k+"+1]/a")).getText().toUpperCase().trim();
if(matchtype_from_excel.equals(matchtype_from_entry)){
category.get(k+1).click();
}
}
}
I am not sure how, but it is working. 我不知道怎么做,但它确实有效。 Match_type_excel i am getting from excel sheet.
我从excel表获取Match_type_excel。 In the excel itself entered as capital letters.
在excel本身输入大写字母。 In the code I used touppercase method.
在代码中我使用了touppercase方法。 Still did not work.
仍然没有奏效。 But having capital letters in excel is working fine...
但在excel中使用大写字母工作正常......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.