I have table that I find it by id.
WebElement table = driver.findElement(By.id("tableId");
After that I make findElements
List<WebElement> rows = table.findElements(By.cssSelector("tbody tr");
It return also the header meaning the tr under thead.
When I change it as below it does work.
List<WebElement> rows = table.findElements(By.cssSelector("tbody > tr");
The table is inside the body of another table so looks like it find all tr under table (that include the th) and are on any tbody even it not under the table.
Is this the expected behaviour ?
Thanks
<table id='tableId'>
<tbody id='tbody1'>
<tr id='tr1'><td><table id='table2'><tbody id='tbody2'><tr id='tr2'>...</tr></tbody></table></td></tr></tbody></table>
WebElement table1 = driver.findElement(By.id("tableId"));List<WebElement> rows = table1.findElements(By.cssSelector("tbody tr"));