selenium webdriver - How to judge whether an element does not exist? -


I want to stimulate a case when an element does not exist, but it throws an exception. I have to wait unexpectedly Waiting time is another better way?

This is not clear from your question, but if you have a case of testing when an element does not exist, Then use findElements instead of findElements .

Something like this:

  driver.field elements (// your criteria)  

Even if your element does not exist, This error does not throw away 'instead it returns an empty list, you can use the size method to check!

Hope it helps.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -