From f6b5664aae0cb8c00e7cbfb35653524fe195403c Mon Sep 17 00:00:00 2001 From: Russell Jarvis <rjjarvis@asu.edu> Date: Wed, 24 Jun 2020 10:12:01 +1000 Subject: [PATCH] changes --- scrape.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/scrape.py b/scrape.py index 81e97a2..7fa359b 100644 --- a/scrape.py +++ b/scrape.py @@ -55,15 +55,6 @@ from selenium.common.exceptions import NoSuchElementException from selenium import webdriver import os -''' -chrome_options = webdriver.ChromeOptions() -chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN") -chrome_options.add_argument("--headless") -chrome_options.add_argument("--disable-dev-shm-usage") -chrome_options.add_argument("--no-sandbox") - -driver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options) -''' options = Options() options.binary_location = "/app/vendor/firefox/firefox" options.add_argument("--headless") @@ -82,17 +73,26 @@ except: driver = webdriver.Firefox(options=options,executable_path="/app/vendor/geckodriver/geckodriver") except: - #GECKODRIVER_PATH="/app/vendor/geckodriver/geckodriver" - #driver = webdriver.Firefox(options=options,executable_path=GECKODRIVER_PATH) - os.system("wget wget https://ftp.mozilla.org/pub/firefox/releases/45.0.2/linux-x86_64/en-GB/firefox-45.0.2.tar.bz2") - os.system("wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz") - os.system("tar -xf geckodriver-v0.26.0-linux64.tar.gz") - os.system("tar xvf firefox-45.0.2.tar.bz2") - GECKODRIVER_PATH=str(os.getcwd())+str("/geckodriver") - #FF=str(os.getcwd())+str("firefox") - options.binary_location = str('./firefox') - #driver = webdriver.Firefox(options=options,executable_path=FF) - driver = webdriver.Firefox(options=options,executable_path=GECKODRIVER_PATH) + try: + chrome_options = webdriver.ChromeOptions() + chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN") + chrome_options.add_argument("--headless") + chrome_options.add_argument("--disable-dev-shm-usage") + chrome_options.add_argument("--no-sandbox") + + driver = webdriver.Chrome(executable_path=os.environ.get("CHROMEDRIVER_PATH"), chrome_options=chrome_options) + except: + #GECKODRIVER_PATH="/app/vendor/geckodriver/geckodriver" + #driver = webdriver.Firefox(options=options,executable_path=GECKODRIVER_PATH) + os.system("wget wget https://ftp.mozilla.org/pub/firefox/releases/45.0.2/linux-x86_64/en-GB/firefox-45.0.2.tar.bz2") + os.system("wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz") + os.system("tar -xf geckodriver-v0.26.0-linux64.tar.gz") + os.system("tar xvf firefox-45.0.2.tar.bz2") + GECKODRIVER_PATH=str(os.getcwd())+str("/geckodriver") + #FF=str(os.getcwd())+str("firefox") + options.binary_location = str('./firefox') + #driver = webdriver.Firefox(options=options,executable_path=FF) + driver = webdriver.Firefox(options=options,executable_path=GECKODRIVER_PATH) -- GitLab