def get_browser(): """ Wrapper to get the selenium driver. """ driver = None driver_name = settings.WEB_DRIVER_NAME try: driver = _DRIVERS[driver_name] except KeyError: raise DriverNotFoundError("No driver for %s" % driver_name) attrs = { "headless": settings.HEADLESS_MODE, } return get_driver(driver, **attrs)
def Browser(driver_name='firefox', *args, **kwargs): """ Returns a driver instance for the given name. When working with ``firefox``, it's possible to provide a profile name and a list of extensions. If you don't provide any driver_name, then ``firefox`` will be used. If there is no driver registered with the provided ``driver_name``, this function will raise a :class:`splinter.exceptions.DriverNotFoundError` exception. """ try: driver = _DRIVERS[driver_name] return driver(*args, **kwargs) except KeyError: raise DriverNotFoundError("No driver for %s" % driver_name)