From d6c521d1c4dc7a5e5e441cc77e316178d9bcba53 Mon Sep 17 00:00:00 2001 From: CHUN YU YAO Date: Mon, 10 Jan 2022 12:51:58 +0800 Subject: [PATCH] ver 2022-01-10, fix for Firefox --- README.md | 2 +- chrome_tixcraft.py | 5 +++-- settings.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8ebcf86..9b73d2a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ PS: * 請到ChromeDriver網站 (https://chromedriver.chromium.org/) 下載與您目前相同版本的 ChromeDriver 的執行檔,放在搶票程式的webdriver目錄下(Mac電腦請放到 MaxBot.app 套件裡的 /Contents/Resources/webdriver/),在執行搶票程式前,第一次執行搶票主程式前,前請先手動點 ChromeDriver 的執行檔。 * 最後透過 python3 執行 settings.py 就可以有 GUI 的設定界面。) * 如果你是使用 macOS 並且執行環境沒有 python3,請 python 官方網站(https://www.python.org/downloads/)來安裝 python3, 如果在 macOS 裡會使用終端機(Terminal),建議使用 https://brew.sh/ 安裝 python3. - +* 如果你是使用 Firefox, ChromeDriver 的元件是叫 geckodriver,下載點在:https://github.com/mozilla/geckodriver/releases ,與 ChromeDriver 的處理方式是一樣,如果是 mac 電腦,要在元件按右鍵開啟,做一次授權的動作。 # Introduce the implement (實作方法) https://stackoverflow.max-everyday.com/2018/03/selenium-chrome-webdriver/ diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index c9788eb..97fadb4 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -59,7 +59,7 @@ ssl._create_default_https_context = ssl._create_unverified_context #附註1:沒有寫的很好,很多地方應該可以模組化。 #附註2: -CONST_APP_VERSION = u"MaxBot (2021.12.28)" +CONST_APP_VERSION = u"MaxBot (2022.01.10)" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top" @@ -376,7 +376,8 @@ if not config_dict is None: chromedriver_path =Root_Dir+ "webdriver/geckodriver" if platform.system()=="windows": chromedriver_path =Root_Dir+ "webdriver/geckodriver.exe" - driver = webdriver.Firefox(executable_path=chromedriver_path) + firefox_service = Service(chromedriver_path) + driver = webdriver.Firefox(service=firefox_service) time.sleep(1.0) try: diff --git a/settings.py b/settings.py index e76bf99..6b90a17 100644 --- a/settings.py +++ b/settings.py @@ -17,7 +17,7 @@ import sys import platform import json -CONST_APP_VERSION = u"MaxBot (2021.12.28)" +CONST_APP_VERSION = u"MaxBot (2022.01.10)" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"