|
@ -1,25 +1,21 @@ |
|
|
import re |
|
|
from ..exceptions import UnknownOSException |
|
|
import zipfile |
|
|
from .common import NO_CHROME_DRIVER |
|
|
import os, sys, stat, platform |
|
|
|
|
|
from urllib.request import urlretrieve |
|
|
|
|
|
from collections import namedtuple |
|
|
|
|
|
|
|
|
|
|
|
from clint.textui import puts, colored |
|
|
from clint.textui import puts, colored |
|
|
import progressbar |
|
|
from collections import namedtuple |
|
|
|
|
|
|
|
|
from selenium import webdriver |
|
|
from selenium import webdriver |
|
|
|
|
|
from urllib.request import urlretrieve |
|
|
|
|
|
from enum import Enum |
|
|
|
|
|
|
|
|
from .common import NO_CHROME_DRIVER |
|
|
import os, sys, stat, platform |
|
|
from ..exceptions import UnknownOSException |
|
|
import progressbar |
|
|
|
|
|
import re |
|
|
|
|
|
import zipfile |
|
|
_ = namedtuple('WebDrivers', 'mac linux windows') |
|
|
|
|
|
drivers = ['https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_mac64.zip', |
|
|
|
|
|
'https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_linux64.zip', |
|
|
|
|
|
'https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_win32.zip' |
|
|
|
|
|
] |
|
|
|
|
|
WebDriver = _(drivers[0], drivers[1], drivers[2]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chrome_drivers = { |
|
|
|
|
|
"Windows" : "https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_win32.zip", |
|
|
|
|
|
"Darwin" : "https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_mac64.zip", |
|
|
|
|
|
"Linux" : "https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_linux64.zip" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def extract_zip(filename): |
|
|
def extract_zip(filename): |
|
|
""" |
|
|
""" |
|
@ -71,14 +67,8 @@ def get_webdriver(): |
|
|
else: |
|
|
else: |
|
|
# Download it according to the current machine |
|
|
# Download it according to the current machine |
|
|
|
|
|
|
|
|
os_platform = platform.system() |
|
|
chrome_webdriver = chrome_drivers.get(platform.system(), False) |
|
|
if os_platform == 'Darwin': |
|
|
if not chrome_webdriver: |
|
|
chrome_webdriver = WebDriver.mac |
|
|
|
|
|
elif os_platform == 'Linux': |
|
|
|
|
|
chrome_webdriver = WebDriver.linux |
|
|
|
|
|
elif os_platform == 'Windows': |
|
|
|
|
|
chrome_webdriver = WebDriver.windows |
|
|
|
|
|
else: |
|
|
|
|
|
raise UnknownOSException("Unknown Operating system platform") |
|
|
raise UnknownOSException("Unknown Operating system platform") |
|
|
|
|
|
|
|
|
global total_size |
|
|
global total_size |
|
|