()
get_webdriver() detects an available webdriver and returns it.

    :raises ImportError: of Selenium
get_webdriver() detects an available webdriver and returns it.
get_webdriver () detects an available webdriver and returns it .
def get_webdriver() -> Any:
    """get_webdriver() detects an available webdriver and returns it.

    :raises ImportError: of Selenium
    """

    import selenium.webdriver  # pylint: disable=import-error,import-outside-toplevel

    logger.info('Trying to open Chrome via WebDriver...')
    try:
        return selenium.webdriver.Chrome()
    except selenium.common.exceptions.WebDriverException as e:
        logger.error(e)

    logger.info('Trying to open Firefox via WebDriver...')
    try:
        return selenium.webdriver.Firefox()
    except Exception as e:
        logger.error(e)

    logger.info('Trying to open Edge via WebDriver...')
    try:
        return selenium.webdriver.Edge()
    except Exception as e:
        logger.error(e)

    logger.info('Trying to open Internet Explorer via WebDriver...')
    try:
        return selenium.webdriver.Ie()
    except Exception as e:
        logger.error(e)

    logger.info('Trying to open Safari via WebDriver...')
    try:
        return selenium.webdriver.Safari()
    except Exception as e:
        logger.error(e)

    logger.info('Trying to open Opera via WebDriver...')
    try:
        return selenium.webdriver.Opera()
    except Exception as e:
        logger.error(e)

    logger.error('No WebDriver is available.')
    logger.info(utils.HINT + textwrap.dedent("""
        Please install a WebDriver.
        See https://www.selenium.dev/documentation/en/webdriver/driver_requirements/

        Detailed instructions:
            If you use Ubuntu:
                1. Run $ sudo apt install chromium-chromedriver firefox-geckodriver
            If you use Ubuntu under Windows Subsystem for Linux:
                1. Make a symbolic link from cookie.jar in WSL to cookie.jar out of WSL. For example, run $ ln -s /mnt/c/Users/%USERNAME%/AppData/Local/online-judge-tools/online-judge-tools/cookie.jar /home/ubuntu/.local/share/online-judge-tools/cookie.jar
                2. Use `oj login` outside of WSL
            If you use Windows:
                1. Install Chocolatey. See https://chocolatey.org/
                2. Run > choco install selenium-all-drivers
    """))
    raise WebDriverException('No WebDriver is installed.')
def get_webdriver ( ) -> Any : import selenium . webdriver # pylint: disable=import-error,import-outside-toplevel logger . info ( 'Trying to open Chrome via WebDriver...' ) try : return selenium . webdriver . Chrome ( ) except selenium . common . exceptions . WebDriverException as e : logger . error ( e ) logger . info ( 'Trying to open Firefox via WebDriver...' ) try : return selenium . webdriver . Firefox ( ) except Exception as e : logger . error ( e ) logger . info ( 'Trying to open Edge via WebDriver...' ) try : return selenium . webdriver . Edge ( ) except Exception as e : logger . error ( e ) logger . info ( 'Trying to open Internet Explorer via WebDriver...' ) try : return selenium . webdriver . Ie ( ) except Exception as e : logger . error ( e ) logger . info ( 'Trying to open Safari via WebDriver...' ) try : return selenium . webdriver . Safari ( ) except Exception as e : logger . error ( e ) logger . info ( 'Trying to open Opera via WebDriver...' ) try : return selenium . webdriver . Opera ( ) except Exception as e : logger . error ( e ) logger . error ( 'No WebDriver is available.' ) logger . info ( utils . HINT + textwrap . dedent ( """
        Please install a WebDriver.
        See https://www.selenium.dev/documentation/en/webdriver/driver_requirements/

        Detailed instructions:
            If you use Ubuntu:
                1. Run $ sudo apt install chromium-chromedriver firefox-geckodriver
            If you use Ubuntu under Windows Subsystem for Linux:
                1. Make a symbolic link from cookie.jar in WSL to cookie.jar out of WSL. For example, run $ ln -s /mnt/c/Users/%USERNAME%/AppData/Local/online-judge-tools/online-judge-tools/cookie.jar /home/ubuntu/.local/share/online-judge-tools/cookie.jar
                2. Use `oj login` outside of WSL
            If you use Windows:
                1. Install Chocolatey. See https://chocolatey.org/
                2. Run > choco install selenium-all-drivers
    """ ) ) raise WebDriverException ( 'No WebDriver is installed.' )