I try all and didnt find how to get to the error messeage thx for the help
Asked
Active
Viewed 39 times
-1
-
This might help you [SO Archive link](https://stackoverflow.com/questions/19003003/check-if-any-alert-exists-using-selenium-with-python) – Anand Gautam Mar 23 '22 at 15:57
1 Answers
3
Looks like that is an alert.
You will have to switch to it before extracting the text.
try:
time.sleep(2)
Alert = driver.switch_to.alert
print(Alert.text)
except:
print('Could not interact with Alert')
pass
cruisepandey
- 26,802
- 6
- 16
- 37
-
2You can assert like this `"assert "paste error message here" in Alert.text"` – cruisepandey Mar 23 '22 at 16:02