fedest
fedest

Reputation: 1350

Selenium wait for element to reload

I'm trying to do the following:

I have a page that has a list of comments (each comment is a div and the list is a div containing all of these). There's a button at the end of the page to load more comments. These comments are load as an "infinite scroll". They are appended to the ones present.

I have to perform in Selenium a click to this button to bring more comments and then wait until the new comments are loaded.

How do I do this? I have no way of differentiating the new comments from the old ones. Is there a hook to know when an element changes? I mean, when an element gets added more elements to it's children.

Upvotes: 0

Views: 541

Answers (1)

Conrad Albrecht
Conrad Albrecht

Reputation: 2066

I don't know about a hook; Selenium seems to implement these waits with "polling" rather than hooks.

So, can you wait on a condition, the condition being that the list contains the expected new number of comments?

Upvotes: 2

Related Questions