Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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'),
async def test_chained_actions(session):
if isinstance(session.browser, Firefox) and isinstance(session.service, Remote):
pytest.xfail('remote firefox actions do not work')
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')
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()
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(),
)