-1

How i find xpath for the messeage error up for testing

I try all and didnt find how to get to the error messeage thx for the help

  • 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 Answers1

2

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
  • 28,520
  • 6
  • 20
  • 38