How to use assertion to compare both different size of the rows?
briley last edited by
I want both size of the rows shouldn't be matched.
int firstnum = 0; List<WebElement> preRoutlList = driver.findElements(By.xpath("//*[@id='txBottomTable']/table/tbody/tr")); firstnum = firstnum + preRoutlList.size(); int secondnum = 0; List<WebElement> aftRoutlList = driver.findElements(By.xpath("//*[@id='txBottomTable']/table/tbody/tr")); secondnum = secondnum + aftRoutlList.size();
There are a few different ways to achieve that depending on how you prefer to do things:
As another person has commented you don't appear to need those int declarations, so can just use the .size() call.
//Assert false that one equals the other Assert.assertFalse(preRoutlList.size()==aftRoutlList.size()); //Assert True that one doesn't equal the other Assert.assertTrue(preRoutlList.size()!=aftRoutlList.size());