I have a table with data. I need to check that table contains some data and does not contain any other data. So I need to check that table contains entries equal to some unique value.
I solved that task in two steps:
The first step is using
contains() which check that table contains interesting elements.
Second step checks that table does not have other elements which are not equal search value by using
not contains() function.
List <WebElement> rows = tableBody.findElements(By.xpath("//*[not(contains(td,"+ elementName + "))]"));
This solution is not good, because
not contains() function runs twice longer.
Is there other solution how to check that table has elements with search pattern and contains only them?