Assume that I have a web page that has records, displayed in a table ( that has several columns). Now there is search-input-box and a search-button. Using those I am searching for records with an id in the table.
I am using implicit wait which seems to be working fine in most of the cases and failing under this scenario :
- I made the page to load all the data in the table after I logged in using implicit wait
- Entered id in the search-input-box and clicked search-button
- Now I am expecting only one record instead of all the records that were
displayed in the table before the search happened
It seems that it did not find enough time to refresh the table and still showing all the records even though I do search with ( for the id columns in the table):
List<WebElement> idRows = driver.wait(<waittime>, <interval>).until(driver -> driver.findElement(By.id("column-id")));
If I use Thread.sleep() after clicking the search-button, everything is fine as I am seeing the table has been refreshed with the expected result. However, I have to avoid using thread.sleep.
May I get any suggestion on how can I make it wait until the table has been refreshed with searched data?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…