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


Python fixtures.create_dialog函数代码示例

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


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

示例1: test_handle_prompt_missing_value

def test_handle_prompt_missing_value(session):
    # 13.6 step 2
    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_error(result, "unexpected alert open")
    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_error(result, "unexpected alert open")
    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_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")
开发者ID:EdgarChen,项目名称:servo,代码行数:31,代码来源:get_element_tag_name.py

示例2: test_handle_prompt_dismiss

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

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

    result = get_attribute(session, element.id, "id")

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

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

    result = get_attribute(session, element.id, "id")

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

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

    result = get_attribute(session, element.id, "id")

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

示例3: test_handle_prompt_dismiss

def test_handle_prompt_dismiss(new_session):
    _, session = new_session({"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "dismiss"}}})
    session.url = inline("<body><p>Hello, World!</p></body>")

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

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

    assert_result_is_active_element(session, result)
    assert_dialog_handled(session, "dismiss #1")
    assert session.execute_script("return dismiss1;") == None

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

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

    assert_result_is_active_element(session, result)
    assert_dialog_handled(session, "dismiss #2")
    assert read_global(session, "dismiss2") == None

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

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

    assert_result_is_active_element(session, result)
    assert_dialog_handled(session, "dismiss #3")
    assert read_global(session, "dismiss3") == None
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:30,代码来源:get_active_element.py

示例4: test_handle_prompt_accept

def test_handle_prompt_accept(new_session):
    _, session = new_session({"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "accept"}}})
    session.url = inline("<body><p>Hello, World!</p></body>")
    create_dialog(session)("alert", text="accept #1", result_var="accept1")

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

    assert_result_is_active_element(session, result)
    assert_dialog_handled(session, "accept #1")
    assert read_global(session, "accept1") == None

    create_dialog(session)("confirm", text="accept #2", result_var="accept2")

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

    assert_result_is_active_element(session, result)
    assert_dialog_handled(session, "accept #2")
    assert read_global(session, "accept2"), True

    create_dialog(session)("prompt", text="accept #3", result_var="accept3")

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

    assert_result_is_active_element(session, result)
    assert_dialog_handled(session, "accept #3")
    assert read_global(session, "accept3") == ""
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:29,代码来源:get_active_element.py

示例5: test_title_handle_prompt_missing_value

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

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

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #1")
    assert read_global(session, "accept1") == None

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

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

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #2")
    assert read_global(session, "dismiss2") == False

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

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

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")
    assert read_global(session, "dismiss3") == None
开发者ID:atotic,项目名称:web-platform-tests,代码行数:28,代码来源:get_title.py

示例6: test_handle_prompt_missing_value

def test_handle_prompt_missing_value(session, create_dialog):
    session.url = inline("<body><p>Hello, World!</p></body>")

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

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

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #1")
    assert session.execute_script("return accept1;") == None

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

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

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #2")
    assert session.execute_script("return dismiss2;") == False

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

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

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")
    assert session.execute_script("return dismiss3;") == None
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:29,代码来源:get_active_element.py

示例7: test_handle_prompt_accept

def test_handle_prompt_accept(new_session):
    # 13.3 step 2
    _, session = new_session({"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "accept"}}})
    session.url = inline("<input id=foo>")

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

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

    assert_success(result, "foo")
    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}/property/id"
                                    .format(session_id=session.session_id,
                                            element_id="foo"))

    assert_success(result, "foo")
    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}/property/id"
                                    .format(session_id=session.session_id,
                                            element_id="foo"))

    assert_success(result, "foo")
    assert_dialog_handled(session, "dismiss #3")
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:31,代码来源:get_element_property.py

示例8: test_handle_prompt_missing_value

def test_handle_prompt_missing_value(session):
    # 13.2 step 2
    session.url = inline("<input id=foo>")
    element = session.find.css("#foo", all=False)

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

    result = get_attribute(session, element.id, "id")

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

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

    result = get_attribute(session, element.id, "id")

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #2")

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

    result = get_attribute(session, element.id, "id")

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")
开发者ID:EdgarChen,项目名称:servo,代码行数:25,代码来源:get_element_attribute.py

示例9: 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

示例10: test_handle_prompt_missing_value

def test_handle_prompt_missing_value(session, create_dialog):
    # 13.3 step 2
    session.url = inline("<input id=foo>")

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

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

    assert_error(result, "unexpected alert open")
    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}/property/id"
                                    .format(session_id=session.session_id,
                                            element_id="foo"))

    assert_error(result, "unexpected alert open")
    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}/property/id"
                                    .format(session_id=session.session_id,
                                            element_id="foo"))

    assert_error(result, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:30,代码来源:get_element_property.py

示例11: test_title_handle_prompt_accept

def test_title_handle_prompt_accept(new_session, add_browser_capabilites):
    _, session = new_session({"capabilities": {
        "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
    session.url = inline("<title>WD doc title</title>")
    create_dialog(session)("alert", text="accept #1", result_var="accept1")

    expected_title = read_global(session, "document.title")

    result = get_title(session)
    assert_success(result, expected_title)
    assert_dialog_handled(session, "accept #1")
    assert read_global(session, "accept1") is None

    expected_title = read_global(session, "document.title")
    create_dialog(session)("confirm", text="accept #2", result_var="accept2")

    result = get_title(session)
    assert_success(result, expected_title)
    assert_dialog_handled(session, "accept #2")
    assert read_global(session, "accept2") is True

    expected_title = read_global(session, "document.title")
    create_dialog(session)("prompt", text="accept #3", result_var="accept3")

    result = get_title(session)
    assert_success(result, expected_title)
    assert_dialog_handled(session, "accept #3")
    assert read_global(session, "accept3") == "" or read_global(session, "accept3") == "undefined"
开发者ID:birtles,项目名称:web-platform-tests,代码行数:28,代码来源:user_prompts.py

示例12: test_title_handle_prompt_accept

def test_title_handle_prompt_accept(new_session):
    _, session = new_session({"alwaysMatch": {"unhandledPromptBehavior": "accept"}})
    session.url = inline("<title>WD doc title</title>")
    create_dialog(session)("alert", text="accept #1", result_var="accept1")

    expected_title = read_global(session, "document.title")
    result = session.transport.send("GET",
                                    "session/%s/title" % session.session_id)

    assert_success(result, expected_title)
    assert_dialog_handled(session, "accept #1")
    assert read_global(session, "accept1") == None

    expected_title = read_global(session, "document.title")
    create_dialog(session)("confirm", text="accept #2", result_var="accept2")

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

    assert_success(result, expected_title)
    assert_dialog_handled(session, "accept #2")
    assert read_global(session, "accept2"), True

    expected_title = read_global(session, "document.title")
    create_dialog(session)("prompt", text="accept #3", result_var="accept3")

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

    assert_success(result, expected_title)
    assert_dialog_handled(session, "accept #3")
    assert read_global(session, "accept3") == ""
开发者ID:atotic,项目名称:web-platform-tests,代码行数:32,代码来源:get_title.py

示例13: test_handle_prompt_accept

def test_handle_prompt_accept(new_session):
    # 13.2 step 2
    _, session = new_session({"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "accept"}}})
    session.url = inline("<input id=foo>")

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

    result = get_attribute(session, "foo", "id")

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

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

    result = get_attribute(session, "foo", "id")

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

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

    result = get_attribute(session, "foo", "id")

    assert_success(result, "foo")
    assert_dialog_handled(session, "dismiss #3")
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:25,代码来源:get_element_attribute.py

示例14: test_handle_prompt_accept

def test_handle_prompt_accept(new_session):
    """
    2. Handle any user prompts and return its value if it is an error.

    [...]

    In order to handle any user prompts a remote end must take the
    following steps:

      [...]

      2. Perform the following substeps based on the current session's
      user prompt handler:

        [...]

        - accept state
           Accept the current user prompt.

    """
    _, session = new_session({"alwaysMatch": {"unhandledPromptBehavior": "accept"}})
    session.url = inline("<title>WD doc title</title>")
    create_dialog(session)("alert", text="accept #1", result_var="accept1")

    expected_title = read_global(session, "document.title")
    response = fullscreen(session)

    assert_success(response, expected_title)
    assert_dialog_handled(session, "accept #1")
    assert read_global(session, "accept1") == None

    expected_title = read_global(session, "document.title")
    create_dialog(session)("confirm", text="accept #2", result_var="accept2")

    response = fullscreen(session)

    assert_success(response, expected_title)
    assert_dialog_handled(session, "accept #2")
    assert read_global(session, "accept2"), True

    expected_title = read_global(session, "document.title")
    create_dialog(session)("prompt", text="accept #3", result_var="accept3")

    response = fullscreen(session)

    assert_success(response, expected_title)
    assert_dialog_handled(session, "accept #3")
    assert read_global(session, "accept3") == ""
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:48,代码来源:fullscreen_window.py

示例15: test_handle_prompt_missing_value

def test_handle_prompt_missing_value(session, create_dialog):
    """
    2. Handle any user prompts and return its value if it is an error.

    [...]

    In order to handle any user prompts a remote end must take the
    following steps:

      [...]

      2. Perform the following substeps based on the current session's
      user prompt handler:

        [...]

        - missing value default state
           1. Dismiss the current user prompt.
           2. Return error with error code unexpected alert open.

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

    response = fullscreen(session)

    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #1")
    assert read_global(session, "accept1") == None

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

    response = fullscreen(session)

    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #2")
    assert read_global(session, "dismiss2") == False

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

    response = fullscreen(session)

    assert_error(response, "unexpected alert open")
    assert_dialog_handled(session, "dismiss #3")
    assert read_global(session, "dismiss3") == None
开发者ID:Spec-Ops,项目名称:web-platform-tests,代码行数:45,代码来源:fullscreen_window.py


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