Ignore Alert

Ignore Alert #

def ignore_alert(driver: TestUIDriver) -> None

This function will close alert opened by alert(), prompt() or confirm() JavaScript functions.

The function has no effect if no alert is opened.

def test(driver):
    # Example of ignore alert function
    e(driver, "css", '[type=search]').wait_until_visible()
    driver.execute_script("prompt('prompt!');", None)
A typical use case, as shown in the example, is to close an alert if there is one before taking a screenshot.