Selenium JUnit DOM Testing - Problem with counting Dynamic rows
I am using the following code
final String tablePath = "//../div/table"; final int size = Browser.getElements(By.xpath(tablePath).tagName("tbody")).size(); System.out.println("row count=" + size);
How will I show the rowcount which is changing dynamically?
size()function returns the number of elements found with the
getElements()function, I expect it to return just one table element. The value of size equals 1.
I would get the HTML inside the table and count the occurrences of
or something unique per row, expecting you do not have nested tables with rows inside the initial table. The code for that would look something like this:
WebElement table = driver.findElement(By.id("t1")); String tableContent = table.getAttribute("innerHTML"); int count = StringUtils.countMatches(tabelContent, "
After you change the window size you will have to get the
innerHTMLagain and count the rows to see if it actually changed or not.