Updated find geckodriver mechanism
parent
25d441f2f7
commit
7ae973678f
|
@ -9,15 +9,25 @@ from datetime import datetime, timedelta
|
|||
import logging
|
||||
import os
|
||||
import pkg_resources
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
import typing as T
|
||||
from urllib.parse import urlparse
|
||||
|
||||
os.environ['PATH'] = os.environ['PATH'] + \
|
||||
':' + pkg_resources.resource_filename(__name__, 'bin')
|
||||
geckoexe = shutil.which('geckodriver')
|
||||
if geckoexe is None:
|
||||
local_path = pkg_resources.resource_filename(__name__, 'bin')
|
||||
try:
|
||||
os.stat(os.path.join(local_path, 'geckodriver'))
|
||||
os.environ['PATH'] = os.environ['PATH'] + \
|
||||
':' + local_path
|
||||
except FileNotFoundError:
|
||||
print("Missing geckodriver executable in path", file=sys.stderr)
|
||||
raise
|
||||
|
||||
from selenium import webdriver as wd
|
||||
from selenium.common.exceptions import WebDriverException, NoSuchElementException
|
||||
from selenium import webdriver as wd # noqa
|
||||
from selenium.common.exceptions import WebDriverException, NoSuchElementException # noqa
|
||||
|
||||
|
||||
logging.basicConfig(
|
||||
|
|
Loading…
Reference in New Issue