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(base_url, service, http_server):
async with service.driver.run(Tornado) as driver:
async with driver.session(service.browser) as session:
await session.get(f'{base_url}/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(base_url, service, http_server):
async with service.driver.run(Tornado) as driver:
async with driver.session(service.browser) as session:
await session.get(f'{base_url}/')
assert 'Hello Tornado!' in await session.get_page_source()
@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'],
)
),
Tornado
)
async def gecko(func):
await func(
Geckodriver(),
Tornado
)