I'm testing if a website has thrown an error and I myself get an error to see if this happens. So far I am just seeing if a button is clickable so if the button is not clickable/not displayed, then the program is okay to proceed. But if an error is there I need to return a value.
try:
dismissBtn = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, "//input[@value='Dismiss this error']")))
print("Reg Error Button is clickable")
finally:
print("No error")
The error is below
dismissBtn = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, "//input[@value='Dismiss this error']")))
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
HTML Code is below
<div id="6823e3dd-d694-4a3e-99ae-6c074e3af73d" class="unite-error-panel errorPanel unite-component">
<span class="unite-h1-no-image">An error occurred.</span>
<ul>
<li>We are unable to connect to our servers right now. Please try again later.</li>
</ul>
<div id="8977e4fa-bb61-4a51-8b56-5e051b7f95d1" class="unite-error-code" style="display: none;"> {"code":"GENERIC","httpStatus":0}</div>
<div id="0b57d2f0-a8c4-4b7e-8095-ae09054cb053" class="unite-error-close">
<input type="button" value="Dismiss this error">
</div>
</div>
Is there another way I can go around this?