예제 #1
0
def test_handle_prompt_accept(new_session, add_browser_capabilites):
    _, session = new_session({
        "capabilities": {
            "alwaysMatch":
            add_browser_capabilites({"unhandledPromptBehavior": "accept"})
        }
    })
    session.window_handle = create_window(session)()

    session.url = inline("<title>WD doc title</title>")

    create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1")
    response = close(session)
    assert response.status == 200
    assert_dialog_handled(session, "dismiss #1")

    create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2")
    response = close(session)
    assert response.status == 200
    assert_dialog_handled(session, "dismiss #2")

    create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3")
    response = close(session)
    assert response.status == 200
    assert_dialog_handled(session, "dismiss #3")
예제 #2
0
def test_handle_prompt_accept(new_session, add_browser_capabilites):
    _, session = new_session({"capabilities": {
        "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
    original_handle = session.window_handle

    session.window_handle = create_window(session)()
    session.url = inline("<title>WD doc title</title>")

    create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1")
    response = close(session)
    assert response.status == 200

    # Asserting that the dialog was handled requires valid top-level browsing
    # context, so we must switch to the original window.
    session.window_handle = original_handle
    assert_dialog_handled(session, "dismiss #1")

    session.window_handle = create_window(session)()
    session.url = inline("<title>WD doc title</title>")

    create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2")
    response = close(session)
    assert response.status == 200

    # Asserting that the dialog was handled requires valid top-level browsing
    # context, so we must switch to the original window.
    session.window_handle = original_handle
    assert_dialog_handled(session, "dismiss #2")

    session.window_handle = create_window(session)()
    session.url = inline("<title>WD doc title</title>")

    create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3")
    response = close(session)
    assert response.status == 200

    # Asserting that the dialog was handled requires valid top-level browsing
    # context, so we must switch to the original window.
    session.window_handle = original_handle
    assert_dialog_handled(session, "dismiss #3")
예제 #3
0
def test_handle_prompt_accept(new_session, add_browser_capabilites):
    _, session = new_session({"capabilities": {
        "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
    original_handle = session.window_handle

    session.window_handle = create_window(session)()
    session.url = inline("<title>WD doc title</title>")

    create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1")
    response = close(session)
    assert response.status == 200

    # Asserting that the dialog was handled requires valid top-level browsing
    # context, so we must switch to the original window.
    session.window_handle = original_handle
    assert_dialog_handled(session, "dismiss #1")

    session.window_handle = create_window(session)()
    session.url = inline("<title>WD doc title</title>")

    create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2")
    response = close(session)
    assert response.status == 200

    # Asserting that the dialog was handled requires valid top-level browsing
    # context, so we must switch to the original window.
    session.window_handle = original_handle
    assert_dialog_handled(session, "dismiss #2")

    session.window_handle = create_window(session)()
    session.url = inline("<title>WD doc title</title>")

    create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3")
    response = close(session)
    assert response.status == 200

    # Asserting that the dialog was handled requires valid top-level browsing
    # context, so we must switch to the original window.
    session.window_handle = original_handle
    assert_dialog_handled(session, "dismiss #3")
예제 #4
0
def test_handle_prompt_missing_value(session, create_dialog, create_window):
    session.window_handle = create_window()

    session.url = inline("<title>WD doc title</title>")
    create_dialog("alert", text="dismiss #1", result_var="dismiss1")

    response = close(session)

    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #1")

    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")

    response = close(session)
    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #2")

    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")

    response = close(session)
    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")
예제 #5
0
def test_handle_prompt_missing_value(session, create_dialog, create_window):
    session.window_handle = create_window()

    session.url = inline("<title>WD doc title</title>")
    create_dialog("alert", text="dismiss #1", result_var="dismiss1")

    response = close(session)

    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #1")

    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")

    response = close(session)
    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #2")

    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")

    response = close(session)
    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")