How can I handle Selenium try except web error messages in python?

On my web page are two different type of errors. The first one is: <div class="warning" data-text="text-field-error" dir="ltr">Diese ID ist nicht verf├╝gbar.</div> And the second one is: <div class="separator-notice text-notice text-margin theme-noticeerror-font" dir="ltr">Bei der Verbindung zum Server ist eine Zeit├╝berschreitung aufgetreten.</div> for example if I try wrong email it doesnt have a specific value how… Read More How can I handle Selenium try except web error messages in python?