当前位置: 首页>>代码示例>>Python>>正文


Python inline.inline函数代码示例

本文整理汇总了Python中tests.support.inline.inline函数的典型用法代码示例。如果您正苦于以下问题:Python inline函数的具体用法?Python inline怎么用?Python inline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了inline函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_is_stale

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")
开发者ID:EdgarChen,项目名称:servo,代码行数:7,代码来源:stale.py

示例2: test_null_response_value

def test_null_response_value(session):
    session.url = inline("<div>")
    session.url = inline("<p>")

    response = back(session)
    value = assert_success(response)
    assert value is None
开发者ID:ConnorGBrewster,项目名称:servo,代码行数:7,代码来源:back.py

示例3: test_connected_element

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")
开发者ID:Jayflux,项目名称:servo,代码行数:7,代码来源:element_clear.py

示例4: pages

def pages(session):
    pages = [
        inline("<p id=1>"),
        inline("<p id=2>"),
    ]

    for page in pages:
        session.url = page

    return pages
开发者ID:Coder206,项目名称:servo,代码行数:10,代码来源:user_prompts.py

示例5: test_data_urls

def test_data_urls(session):
    test_pages = [
        inline("<p id=1>"),
        inline("<p id=2>"),
    ]

    for page in test_pages:
        session.url = page
    assert session.url == test_pages[1]

    response = back(session)
    assert_success(response)
    assert session.url == test_pages[0]
开发者ID:Coder206,项目名称:servo,代码行数:13,代码来源:back.py

示例6: test_null_response_value

def test_null_response_value(session):
    session.url = inline("<p>foo")
    element = session.find.css("p", all=False)

    response = element_click(session, element)
    value = assert_success(response)
    assert value is None
开发者ID:Coder206,项目名称:servo,代码行数:7,代码来源:click.py

示例7: test_element_stale

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")
开发者ID:Coder206,项目名称:servo,代码行数:7,代码来源:get.py

示例8: test_null_response_value

def test_null_response_value(session):
    session.url = inline(iframe("<p>foo"))
    frame_element = session.find.css("iframe", all=False)

    response = switch_to_frame(session, frame_element)
    value = assert_success(response)
    assert value is None
开发者ID:ConnorGBrewster,项目名称:servo,代码行数:7,代码来源:switch.py

示例9: test_resettable_element_does_not_satisfy_validation_constraints

def test_resettable_element_does_not_satisfy_validation_constraints(session, type, invalid_value):
    """
    Some UAs allow invalid input to certain types of constrained
    form controls.  For example, Gecko allows non-valid characters
    to be typed into <input type=number> but Chrome does not.
    Since we want to test that Element Clear works for clearing the
    invalid characters in these UAs, it is fine to skip this test
    where UAs do not allow the element to not satisfy its constraints.
    """
    session.url = inline("<input type=%s>" % type)
    element = session.find.css("input", all=False)

    def is_valid(element):
        return session.execute_script("""
            var input = arguments[0];
            return input.validity.valid;
            """, args=(element,))

    # value property does not get updated if the input is invalid
    element.send_keys(invalid_value)

    # UA does not allow invalid input for this form control type
    if is_valid(element):
        return

    response = element_clear(session, element)
    assert_success(response)
    assert is_valid(element)
开发者ID:Jayflux,项目名称:servo,代码行数:28,代码来源:element_clear.py

示例10: test_duplicated_cookie

def test_duplicated_cookie(session, url):
    session.url = url("/common/blank.html")
    clear_all_cookies(session)
    create_cookie_request = {
        "cookie": {
            "name": "hello",
            "value": "world",
            "domain": "web-platform.test",
            "path": "/",
            "httpOnly": False,
            "secure": False
        }
    }
    result = session.transport.send("POST", "session/%s/cookie" % session.session_id, create_cookie_request)
    assert result.status == 200
    assert "value" in result.body
    assert isinstance(result.body["value"], dict)

    session.url = inline("<script>document.cookie = 'hello=newworld; domain=web-platform.test; path=/';</script>")
    result = session.transport.send("GET", "session/%s/cookie" % session.session_id)
    assert result.status == 200
    assert "value" in result.body
    assert isinstance(result.body["value"], list)
    assert len(result.body["value"]) == 1
    assert isinstance(result.body["value"][0], dict)

    cookie = result.body["value"][0]
    assert "name" in cookie
    assert isinstance(cookie["name"], basestring)
    assert "value" in cookie
    assert isinstance(cookie["value"], basestring)

    assert cookie["name"] == "hello"
    assert cookie["value"] == "newworld"
开发者ID:EdgarChen,项目名称:web-platform-tests,代码行数:34,代码来源:get_named_cookie.py

示例11: test_handle_prompt_accept

def test_handle_prompt_accept(new_session, add_browser_capabilites):
    # 13.6 step 2
    _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
    session.url = inline("<input id=foo>")
    element = session.find.css("#foo", all=False)

    create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1")

    result = session.transport.send("GET", "session/{session_id}/element/{element_id}/name"
                                    .format(session_id=session.session_id,
                                            element_id=element.id))

    assert_success(result, "input")
    assert_dialog_handled(session, "dismiss #1")

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

    result = session.transport.send("GET", "session/{session_id}/element/{element_id}/name"
                                    .format(session_id=session.session_id,
                                            element_id=element.id))

    assert_success(result, "input")
    assert_dialog_handled(session, "dismiss #2")

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

    result = session.transport.send("GET", "session/{session_id}/element/{element_id}/name"
                                    .format(session_id=session.session_id,
                                            element_id=element.id))

    assert_success(result, "input")
    assert_dialog_handled(session, "dismiss #3")
开发者ID:EdgarChen,项目名称:servo,代码行数:32,代码来源:get_element_tag_name.py

示例12: test_transparent_element

def test_transparent_element(session):
    session.url = inline("""<input style="opacity: 0">""")
    element = session.find.css("input", all=False)

    response = element_send_keys(session, element, "foo")
    assert_success(response)
    assert element.property("value") == "foo"
开发者ID:ConnorGBrewster,项目名称:servo,代码行数:7,代码来源:interactability.py

示例13: test_element_not_editable

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")
开发者ID:emilio,项目名称:servo,代码行数:7,代码来源:element_clear.py

示例14: test_clear_content_editable_resettable_element

def test_clear_content_editable_resettable_element(session, element):
    # 14.2 Step 8
    url = element[1] + """<input id=focusCheck type=checkbox>
                    <input id=blurCheck type=checkbox>
                    <script>
                    var id = %s
                    document.getElementById("id").addEventListener("focus", checkFocus);
                    document.getElementById("id").addEventListener("blur", checkBlur);
                    document.getElementById("empty").addEventListener("focus", checkFocus);
                    document.getElementById("empty").addEventListener("blur", checkBlur);

                    function checkFocus() {
                        document.getElementById("focusCheck").checked = true;
                    }
                    function checkBlur() {
                        document.getElementById("blurCheck").checked = true;
                    }
                    </script>""" % element[0]
    session.url = inline(url)
    # Step 1
    empty_element = session.find.css("#empty", all=False)
    test_clear_element_helper(session, empty_element, False)
    session.execute_script("document.getElementById(\"focusCheck\").checked = false;")
    session.execute_script("document.getElementById(\"blurCheck\").checked = false;")
    # Step 2 - 4
    test_element = session.find.css("#" + element[0], all=False)
    test_clear_element_helper(session, test_element, True)
开发者ID:emilio,项目名称:servo,代码行数:27,代码来源:element_clear.py

示例15: test_element_pointer_events_disabled

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")
开发者ID:emilio,项目名称:servo,代码行数:7,代码来源:element_clear.py


注:本文中的tests.support.inline.inline函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。