[Python] Getting "Exception UnexpectedAlertPresentException: Alert Text: None" and then...

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    We're doing automation scripts using the following:

    • behave==1.2.5
    • splinter==0.7.7
    • firefox headless browser

    When navigating to a specific page, we're executing the following code:

    browser = context.browser
    selector_button_checkout = "//*[@id='cart']//div[contains(@class, 'button button-3 localizejs') and text()='CHECKOUT']"
    with browser.get_iframe(0) as iframe:
    assert iframe.is_element_present_by_xpath(selector_button_checkout, wait_time=30)


    We're getting this error:

    packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
    Message:

    Exception UnexpectedAlertPresentException: Alert Text: None
    Message:

    Traceback (most recent call last):
    selenium.common.exceptions.UnexpectedAlertPresentException: Alert Text: None
    Message:


    Actually, there is no alert nor prompt shown in the web, but anyways we tried to handle it using the Splinter documentation present in here http://splinter.readthedocs.io/en/latest/iframes-and-alerts.html

    and we get another exception which is NoAlertPresentException, so we're lost.

    Any ideas?

    Continue reading...

Compartilhe esta Página