How to use the arsenic.session.CompatSession function in arsenic

To help you get started, we’ve selected a few arsenic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HDE / arsenic / tests / test_real_browsers.py View on Github external
async def test_change_window(session):
    if isinstance(session, CompatSession) or isinstance(
        session.driver.connection, RemoteConnection
    ):
        raise pytest.skip("not supported in compat session at the moment")
    handles = await session.get_window_handles()
    assert len(handles) == 1
    for i in range(4):
        await session.execute_script("window.open();")

    async def checker():
        handles = await session.get_window_handles()
        if len(handles) == 5:
            return handles
        return False

    handles = await session.wait(5, checker)
    await session.switch_to_window(handles[2])
github HDE / arsenic / tests / test_real_browsers.py View on Github external
async def check(actions, expected):
        await session.perform_actions(actions)
        output = await session.get_element('#output')
        assert expected == await output.get_text()

    await session.get('/actions/')
    output = await session.wait_for_element(5, '#output')
    assert '' == await output.get_text()
    mouse = Mouse()
    keyboard = Keyboard()
    canvas = await session.get_element('#canvas')
    ctx = (
        pytest.raises(OperationNotSupported)
        if
        isinstance(session, CompatSession)
        else
        null_context
    )
    await session.get('/actions/')

    output = await session.wait_for_element(5, '#output')
    assert '' == await output.get_text()

    mouse = Mouse()
    keyboard = Keyboard()
    canvas = await session.get_element('#canvas')

    # keyboard actions cannot be emulated in non-w3c drivers
    ctx = (
        pytest.raises(OperationNotSupported)
        if
github HDE / arsenic / tests / test_real_browsers.py View on Github external
output = await session.wait_for_element(5, "#output")
    assert "" == await output.get_text()

    await session.get("/actions/")

    output = await session.wait_for_element(5, "#output")
    assert "" == await output.get_text()

    mouse = Mouse()
    keyboard = Keyboard()
    canvas = await session.get_element("#canvas")

    # keyboard actions cannot be emulated in non-w3c drivers
    ctx = (
        pytest.raises(OperationNotSupported)
        if isinstance(session, CompatSession)
        else null_context()
    )

    with ctx:
        actions = chain(
            mouse.move_to(canvas),
            mouse.down() & keyboard.down("a"),
            mouse.move_by(10, 20) & keyboard.up("a"),
            mouse.up(),
        )
        await check(actions, "")

        actions = chain(
            mouse.move_to(canvas),
            mouse.down(),
            mouse.move_by(10, 20) & keyboard.down("a"),
github HDE / arsenic / tests / test_real_browsers.py View on Github external
null_context
    )
    await session.get('/actions/')

    output = await session.wait_for_element(5, '#output')
    assert '' == await output.get_text()

    mouse = Mouse()
    keyboard = Keyboard()
    canvas = await session.get_element('#canvas')

    # keyboard actions cannot be emulated in non-w3c drivers
    ctx = (
        pytest.raises(OperationNotSupported)
        if
        isinstance(session, CompatSession)
        else
        null_context()
    )

    with ctx:
        actions = chain(
            mouse.move_to(canvas),
            mouse.down() & keyboard.down('a'),
            mouse.move_by(10, 20) & keyboard.up('a'),
            mouse.up()
        )
        await check(actions, '')

        actions = chain(
            mouse.move_to(canvas),
            mouse.down(),