summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/webdriver/get_window_handle/chrome.py
blob: af24be4b9e58bdea4ab76f52fc4c3bca113ebe06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from support.context import using_context
from tests.support.asserts import assert_success


def get_window_handle(session):
    return session.transport.send(
        "GET", "session/{session_id}/window".format(**vars(session))
    )


def test_basic(session):
    with using_context(session, "chrome"):
        response = get_window_handle(session)
        assert_success(response, session.window_handle)


def test_different_handle_than_content_scope(session):
    response = get_window_handle(session)
    content_handle = assert_success(response)

    with using_context(session, "chrome"):
        response = get_window_handle(session)
        chrome_handle = assert_success(response)

    assert chrome_handle != content_handle