I'm automating a desktop app with Winium and having trouble with handling error messages using `switch_to_alert`

95 views Asked by At

The App I'm automating is a driver installer. Sometimes it brings up an error, and I want to check for the error, and only clear it if it appears. I thought I would try putting in a wait.until to wait and see if the error appears, then switch_to_alert to clear it

Code -

def check_for_error():
    try:
        wait.until(EC.alert_is_present(), 'The installation of the VuWall Capture V7.24.1 driver failed: 0x800F020B The device instance does not exist in the hardware tree.')
        print("Vision Error seen during install")
        alert = driver.switch_to_alert()
        alert.accept()
    except TimeoutException:
        print("No Error")
if __name__ =="__main__":
    check_for_error()

This returns the following error -

selenium.common.exceptions.WebDriverException: Message: 'getAlertText' is not valid or implemented command.

Do certain Selenium functions not work with Winium?

0

There are 0 answers