Step 1: Store item of the list in a List using findElements
List<WebElement> searchResultlist = Driver.driver.findElements(By.xpath("//span[@class='document-name']"));
Step 2: Use for loop to traverse in the list and verify the text using IF condition.
To make sure input by the user and text from the application are in same case, convert both the strings in UPPER case and match.
for (WebElement resultList : searchResultlist){
System.out.println(resultList.getText());
if (resultList.getText().toUpperCase().contains(DocumentNumber.toUpperCase())){
resultList.click();
break;
}
}
Like this:
Like Loading...