In below piece of code userID gives me the all column values of the current table, but when i try to use those value outside the loop for comparison to other values, it ask to create variable of colValue for class (though I used with List or String or WebElement under the loop). I need to use colValue outside the loop for comparison with the database values.
`
WebElement table = driver.findElement(By.xpath(".//*[@id='DataTables_Table_0']"));
for(int i = 0; i<y; i++){
List<WebElement> allUserId = table.findElements(By.xpath("//td[1]"));
WebElement next1= driver.findElement(By.id("DataTables_Table_0_next"));
System.out.println("User ID = "+ userID.getText());
// String colValue = userID.getText();
}
next1.click();
Thread.sleep(5000);
`WebElement table = driver.findElement(By.xpath(".//*[@id='DataTables_Table_0']"));
int i =0;
for(i = 0; i<= nxtValues; i++){
List<WebElement> allUserId = table.findElements(By.xpath("//td[1]"));
WebElement next1= driver.findElement(By.id("DataTables_Table_0_next"));
for (WebElement userID : allUserId){
// System.out.println("User ID = "+userID.getText());
uservalue.add(userID.getText());
}
next1.click();
Thread.sleep(5000);
}
System.out.println("\nColValues: "+uservalue);
Regards,
Shreekant
do
{
Optional<LibraryTitle> libraryTitle = getLibraryTitles().stream()
.filter(libraryTitle1 -> libraryTitle1.isMatch(epub.getTitle()))
.findFirst();
if (libraryTitle.isPresent())
return addAndViewInReader(libraryTitle.get());
if (isNextButtonDisabled())
break;
else
navigateToNextPage();
} while (true);