python – Check If Selenium’s Web Driver Is Frozen

Is there a way to check if the Selenium web driver didn’t do anything at all last minute?

I have a while True loop waiting for an element to appear. However, sometimes the page loads another page and hence my driver freezes.

Expected page (left) 
What I get sometimes (right)

enter image description here enter image description here

Of course, I could put the following in the while loop:

while True:
   if 'Diese Website ist vorübergehend nicht verfügbar' in driver.page_source:
       break

Then the driver does not freeze. But I have other unforeseen pages as well, so I’m looking for a way that will check if the Selenium web driver didn’t do anything at all last minute.

Read more here: Source link