I have the following code and for some reason it doesn't quit the browser when the two elif
statements are triggered OR go to the except part of the code.
The goal is to return False in every case where the "Solved" attribute is not found. I have tried removing the elif
parts so that it would go to except
part in all of the other cases but it still doesn't work.
while True:
try:
sleep(10)
status = browser.find_element(By.CLASS_NAME, 'status')
if status.get_attribute("innerHTML") == "Solved":
break
elif status.get_attribute("innerHTML") == "Unknown error, watch console":
browser.quit()
print("Unknown error - programm ootab 3 minutit...\n")
sleep(180)
return False
elif status.get_attribute("innerHTML") == "Outdated, should be solved again":
browser.quit()
print("Captcha outdated - programm ootab 3 minutit...\n")
sleep(180)
return False
except:
print('Captcha fked up for some reason \n')
browser.quit()
return False