I have got this try...except block:
try:
browser.find_element('xpath', '/html/body/ul').click()
wait = WebDriverWait(browser, 10)
wait.until(EC.visibility_of_element_located(('xpath', '/html/body/div[1]/div[3]/span')))
return ' '.join(browser.find_element('id', 'response').text.split('\n')[0].split()[:-1])
except ElementNotInteractableException or NoSuchElementException or TimeoutException:
return 'No result'
Still I do get this exception:
wait = WebDriverWait(browser, 10)
File "C:\...\selenium\webdriver\support\wait.py", line 87, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
I have tried handling this exception seperately, which didn't work. So I do not understand how I am supposed to handle it, as the code should just ignore the timeout, since it just means the element wasn't found (which is excpected in ~10% of the time).