Updated find geckodriver mechanism
parent
25d441f2f7
commit
7ae973678f
|
@ -9,15 +9,25 @@ from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import typing as T
|
import typing as T
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
os.environ['PATH'] = os.environ['PATH'] + \
|
geckoexe = shutil.which('geckodriver')
|
||||||
':' + pkg_resources.resource_filename(__name__, 'bin')
|
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 import webdriver as wd # noqa
|
||||||
from selenium.common.exceptions import WebDriverException, NoSuchElementException
|
from selenium.common.exceptions import WebDriverException, NoSuchElementException # noqa
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
|
|
Loading…
Reference in New Issue