Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
@attr.s
class ServiceContext:
driver = attr.ib()
browser = attr.ib()
name = attr.ib()
SERVICE_CONTEXTS = []
if shutil.which('geckodriver'):
SERVICE_CONTEXTS.append(ServiceContext(
driver=Geckodriver(log_file=sys.stdout),
browser=Firefox(),
name='geckofirefox'
))
def get_remote_drivers(remotes):
for remote in remotes.split(' '):
parsed = urlparse(remote)
query = dict(parse_qsl(parsed.query))
browser_name = query.pop('browser', None)
browser = BROWSERS.get(browser_name, None)
if browser is not None:
unparsed = urlunparse((
parsed.scheme,
parsed.netloc,
parsed.path,
async def test_geckodriver_version_ok(tmpdir, version, check, result):
path = tmpdir.join("geckodriver")
path.write(f'#!{sys.executable}\nprint("geckodriver {version}")')
path.chmod(0o755)
driver = Geckodriver(binary=str(path), version_check=check)
if result:
await driver._check_version()
else:
with pytest.raises(ValueError):
await driver._check_version()
async def gecko(func):
await func(
Geckodriver(),
Tornado
)
async def gecko(func):
await func(
Geckodriver(),
Aiohttp
)