Esempio n. 1
0
def test_connected_element(session):
    session.url = inline("<input>")
    element = session.find.css("input", all=False)

    session.url = inline("<input>")
    response = element_clear(session, element)
    assert_error(response, "stale element reference")
Esempio n. 2
0
def test_no_browsing_context(session, create_window):
    new_window = create_window()
    session.window_handle = new_window
    session.close()

    result = get_title(session)
    assert_error(result, "no such window")
Esempio n. 3
0
def test_element_not_found(session):
    # 13.6 Step 3
    result = session.transport.send("GET", "session/{session_id}/element/{element_id}/name"
                                    .format(session_id=session.session_id,
                                            element_id="foo"))

    assert_error(result, "no such element")
Esempio n. 4
0
def test_element_stale(session):
    session.url = inline("<input id=foobar>")
    element = session.find.css("input", all=False)
    session.refresh()

    response = get_element_property(session, element.id, "id")
    assert_error(response, "stale element reference")
Esempio n. 5
0
def test_no_browsing_context(session, create_window):
    # 18.1 step 1
    session.window_handle = create_window()
    session.close()

    response = dismiss_alert(session)
    assert_error(response, "no such window")
Esempio n. 6
0
def test_invalid_parameters(session, parameters):
    response = session.transport.send(
        "POST",
        "/session/{session_id}/permissions".format(**vars(session)),
        parameters
    )
    assert_error(response, "invalid argument")
Esempio n. 7
0
def test_set_to_state_cross_realm(session, create_window, state, realmSetting):
    original_window = session.window_handle
    session.window_handle = create_window()
    parameters = { "descriptor": { "name": "geolocation" }, "state": state }
    parameters.update(realmSetting)

    response = session.transport.send(
        "POST", "/session/{session_id}/permissions".format(**vars(session)),
        parameters
    )

    try:
        assert_success(response)
    except AssertionError:
        # > 4. If parameters.state is an inappropriate permission state for any
        # >    implementation-defined reason, return a WebDriver error with
        # >    WebDriver error code invalid argument.
        assert_error(response, "invalid argument")
        return

    assert response.body.get("value") == None

    session.window_handle = original_window

    response = query(session, "geolocation")

    assert_success(response)
    result = response.body.get("value")

    assert isinstance(result, dict)
    assert result.get("status") == "success"
    assert result.get("value") == state
Esempio n. 8
0
def test_array_in_object(session):
    response = execute_script(session, """
        let arr = [];
        arr.push(arr);
        return {'arrayValue': arr};
        """)
    assert_error(response, "javascript error")
Esempio n. 9
0
def test_object_in_array(session):
    response = execute_script(session, """
        let obj = {};
        obj.reference = obj;
        return [obj];
        """)
    assert_error(response, "javascript error")
Esempio n. 10
0
def test_element_stale(session):
    session.url = inline("<input>")
    element = session.find.css("input", all=False)
    session.refresh()

    result = get_element_css_value(session, element.id, "display")
    assert_error(result, "stale element reference")
Esempio n. 11
0
def test_array(session):
    response = execute_script(session, """
        let arr = [];
        arr.push(arr);
        return arr;
        """)
    assert_error(response, "javascript error")
Esempio n. 12
0
def test_element_not_editable(session):
    # 14.2 Step 3
    session.url = inline("<p>This is not an editable paragraph.")

    element = session.find.css("p", all=False)
    response = clear(session, element)
    assert_error(response, "invalid element state")
Esempio n. 13
0
def test_disabled_element_not_resettable(session):
    # 14.2 Step 3
    session.url = inline("<input type=text value=Federer disabled>")

    element = session.find.css("input", all=False)
    response = clear(session, element)
    assert_error(response, "invalid element state")
Esempio n. 14
0
def test_element_pointer_events_disabled(session):
    # 14.2 Step 7
    session.url = inline("<input type=text value=Federer style=\"pointer-events: none\">")

    element = session.find.css("input", all=False)
    response = clear(session, element)
    assert_error(response, "invalid element state")
Esempio n. 15
0
def test_element_not_found(session):
    # 14.2 Step 2
    response = session.transport.send("POST", "session/{session_id}/element/{element_id}/clear"
                                      .format(session_id=session.session_id,
                                              element_id="box1"))

    assert_error(response, "no such element")
Esempio n. 16
0
def test_get_current_url_alert_prompt(session):
    # 7.2 step 2
    session.url = alert_doc

    result = session.transport.send("GET", "session/%s/url" % session.session_id)

    assert_error(result, "unexpected alert open")
Esempio n. 17
0
def test_element_readonly(session):
    # 14.2 Step 7
    session.url = inline("<input type=text readonly value=Federer>")

    element = session.find.css("input", all=False)
    response = clear(session, element)
    assert_error(response, "invalid element state")
def test_maximize_rect_alert_prompt(session):
    # Step 2
    session.url = alert_doc

    result = session.transport.send("POST", "session/%s/window/maximize" % session.session_id)

    assert_error(result, "unexpected alert open")
def test_maximize_no_browsing_context(session, create_window):
    # Step 1
    session.window_handle = create_window()
    session.close()
    result = session.transport.send("POST", "session/%s/window/maximize" % session.session_id)

    assert_error(result, "no such window")
Esempio n. 20
0
def test_is_stale(session):
    session.url = inline("<button>foo</button>")
    button = session.find.css("button", all=False)
    session.url = inline("<button>bar</button>")

    response = click_element(session, button)
    assert_error(response, "stale element reference")
Esempio n. 21
0
def test_stale(session):
    session.url = inline("<input>")
    element = session.find.css("input", all=False)
    session.refresh()

    result = take_element_screenshot(session, element.id)
    assert_error(result, "stale element reference")
Esempio n. 22
0
def test_await_promise_reject(session):
    response = execute_async_script(session, """
        let resolve = arguments[0];
        await Promise.reject(new Error('my error'));
        resolve('foo');
        """)
    assert_error(response, "javascript error")
Esempio n. 23
0
def test_closed_context(session, create_window):
    new_window = create_window()
    session.window_handle = new_window
    session.close()

    response = get_active_element(session)
    assert_error(response, "no such window")
Esempio n. 24
0
def test_no_browsing_context(session, create_window):
    # 13.1 step 1
    session.window_handle = create_window()
    session.close()

    result = is_element_selected(session, "foo")
    assert_error(result, "no such window")
Esempio n. 25
0
def test_strict_display_none(session, create_files):
    files = create_files(["foo"])
    session.url = inline("""<input type=file style="display: none">""")
    element = session.find.css("input", all=False)

    response = element_send_keys(session, element, str(files[0]))
    assert_error(response, "element not interactable")
Esempio n. 26
0
def test_handle_prompt_default(session, create_dialog, dialog_type):
    create_dialog(dialog_type, text="dialog")

    response = delete_cookie(session, "foo")
    assert_error(response, "unexpected alert open")

    assert_dialog_handled(session, expected_text="dialog")
Esempio n. 27
0
def test_handle_prompt_default(session, create_dialog, dialog_type):
    create_dialog(dialog_type, text="dialog")

    response = get_window_rect(session)
    assert_error(response, "unexpected alert open")

    assert_dialog_handled(session, expected_text="dialog")
Esempio n. 28
0
def test_no_browsing_context(session, create_window):
    # 18.4 step 3
    session.window_handle = create_window()
    session.close()

    response = send_alert_text(session, "Federer")
    assert_error(response, "no such window")
Esempio n. 29
0
def test_element_stale(session):
    session.url = _input
    element = session.find.css("input", all=False)
    session.refresh()

    result = get_element_property(session, element.id, "id")
    assert_error(result, "stale element reference")
def test_no_browsing_context(session, create_window):
    # 18.3 step 1
    session.window_handle = create_window()
    session.close()

    response = get_dialog_text(session)
    assert_error(response, "no such window")
Esempio n. 31
0
def test_no_top_browsing_context(session, closed_window):
    response = get_element_css_value(session, "foo", "bar")
    assert_error(response, "no such window")
Esempio n. 32
0
def test_set_malformed_url(session):
    result = session.transport.send("POST",
                                    "session/%s/url" % session.session_id,
                                    {"url": "foo"})

    assert_error(result, "invalid argument")
Esempio n. 33
0
def test_stale_element_reference(session, stale_element, as_frame):
    element = stale_element("<input>", "input", as_frame=as_frame)

    result = get_element_tag_name(session, element.id)
    assert_error(result, "stale element reference")
Esempio n. 34
0
def test_element_not_found(session):
    result = get_element_tag_name(session, "foo")
    assert_error(result, "no such element")
Esempio n. 35
0
def test_no_browsing_context(session, closed_frame):
    response = get_element_tag_name(session, "foo")
    assert_error(response, "no such window")
Esempio n. 36
0
File: get.py Progetto: svgeesus/wpt
def test_no_top_browsing_context(session, closed_window):
    response = get_current_url(session)
    assert_error(response, "no such window")
Esempio n. 37
0
def test_element_not_found(session):
    result = get_element_css_value(session, "foo", "display")
    assert_error(result, "no such element")
Esempio n. 38
0
def test_invalid_using_argument(session, using):
    # Step 1 - 2
    response = find_elements(session, using, "value")
    assert_error(response, "invalid argument")
Esempio n. 39
0
def test_no_browsing_context(session, closed_window):
    response = take_element_screenshot(session, "foo")
    assert_error(response, "no such window")
Esempio n. 40
0
def test_invalid_selector_argument(session, value):
    # Step 3 - 4
    response = find_elements(session, "css selector", value)
    assert_error(response, "invalid argument")
Esempio n. 41
0
def test_no_browsing_context(session, closed_frame):
    response = delete_cookie(session, "foo")
    assert_error(response, "no such window")
Esempio n. 42
0
def test_no_browsing_context(session, closed_window):
    response = get_named_cookie(session, "foo")
    assert_error(response, "no such window")
Esempio n. 43
0
def test_parent_of_document_node_errors(session):
    session.url = inline("")
    from_element = session.execute_script("return document.documentElement")

    response = find_elements(session, from_element.id, "xpath", "..")
    assert_error(response, "invalid selector")
Esempio n. 44
0
def test_no_browsing_context_when_already_top_level(session, closed_window):
    response = switch_to_parent_frame(session)
    assert_error(response, "no such window")
Esempio n. 45
0
def test_null_parameter_value(session, http):
    path = "/session/{session_id}/frame".format(**vars(session))
    with http.post(path, None) as response:
        assert_error(Response.from_http(response), "invalid argument")
Esempio n. 46
0
def test_no_browsing_context(session, closed_frame):
    response = get_active_element(session)
    assert_error(response, "no such window")
Esempio n. 47
0
def test_no_browsing_context(session, closed_window):
    response = get_computed_label(session)
    assert_error(response, "no such window")
Esempio n. 48
0
def test_no_browsing_context(session, closed_window):
    response = switch_to_frame(session, 1)
    assert_error(response, "no such window")
Esempio n. 49
0
def test_non_editable_inputs(session, type):
    session.url = inline("<input type=%s>" % type)
    element = session.find.css("input", all=False)

    response = element_clear(session, element)
    assert_error(response, "invalid element state")
Esempio n. 50
0
def test_no_user_prompt(session):
    response = get_computed_label(session)
    assert_error(response, "no such alert")
Esempio n. 51
0
def test_textarea_readonly(session):
    session.url = inline("<textarea readonly></textarea>")
    element = session.find.css("textarea", all=False)

    response = element_clear(session, element)
    assert_error(response, "invalid element state")
Esempio n. 52
0
def test_pointer_interactable(session):
    session.url = inline("<input style='margin-left: -1000px' value=foobar>")
    element = session.find.css("input", all=False)

    response = element_clear(session, element)
    assert_error(response, "element not interactable")
Esempio n. 53
0
def test_invalid(session, options):
    response = do_print(session, options)
    assert_error(response, "invalid argument")
Esempio n. 54
0
def test_button(session):
    session.url = inline("<button></button>")
    button = session.find.css("button", all=False)

    response = element_clear(session, button)
    assert_error(response, "invalid element state")
Esempio n. 55
0
def test_no_browsing_context(session, create_window):
    session.window_handle = create_window()
    session.close()
    response = minimize(session)
    assert_error(response, "no such window")
Esempio n. 56
0
def test_input_readonly(session, type):
    session.url = inline("<input type=%s readonly>" % type)
    element = session.find.css("input", all=False)

    response = element_clear(session, element)
    assert_error(response, "invalid element state")
Esempio n. 57
0
def test_alert_unsupported_operation(session):
    session.url = basic_authentication()

    response = send_alert_text(session, "Federer")
    assert_error(response, "unsupported operation")
Esempio n. 58
0
def test_no_top_browsing_context(session, closed_window):
    response = do_print(session, {})
    assert_error(response, "no such window")
Esempio n. 59
0
def test_element_not_found(session):
    # 13.2 Step 3
    result = get_attribute(session, "foo", "id")

    assert_error(result, "no such element")
Esempio n. 60
0
def test_invalid_parameters(session, url, parameters):
    session.url = url("/common/blank.html", protocol="https")
    response = session.transport.send(
        "POST", "/session/{session_id}/permissions".format(**vars(session)),
        parameters)
    assert_error(response, "invalid argument")