Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test_simple_form_submit(app_port, service):
async with service.driver.run(Aiohttp) as driver:
async with driver.session(service.browser) as session:
await session.get(f'http://127.0.0.1:{app_port}/html/')
field = await session.get_element('input[name="field"]')
await field.send_keys('sample input')
submit = await session.get_element('input[type="submit"]')
await submit.click()
assert 'sample input' in await session.get_page_source()
async def test_get_page_source(app_port, service):
async with service.driver.run(Aiohttp) as driver:
async with driver.session(service.browser) as session:
await session.get(f'http://127.0.0.1:{app_port}/')
assert 'Hello Aiohttp!' in await session.get_page_source()
run,
stop
)
@attr.s
class EngineContext:
start_loop = attr.ib()
engine = attr.ib()
name = attr.ib()
ENGINE_CONTEXTS = [
EngineContext(
start_loop=start_aiohttp_loop,
engine=Aiohttp,
name='aiohttp'
),
EngineContext(
start_loop=start_tornado_loop,
engine=Tornado,
name='tornado'
)
async def remote(func):
await func(
Remote(
'http://hub.browserstack.com/wd/hub',
BasicAuth(
os.environ['USERNAME'],
os.environ['PASSWORD'],
)
),
Aiohttp
)
async def gecko(func):
await func(
Geckodriver(),
Aiohttp
)