diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 7925b1a..70b388b 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -31,6 +31,11 @@ body: label: Operating System Version validations: required: true + - type: input + attributes: + label: Browser and Browser Version + validations: + required: true - type: input attributes: label: Python Version diff --git a/requirements.txt b/requirements.txt index abe5334..0b30548 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ selenium -webdriver_manager +chromedriver-autoinstaller pyYAML stackprinter loguru \ No newline at end of file diff --git a/src/backend.py b/src/backend.py index b3b2c0b..c554c37 100644 --- a/src/backend.py +++ b/src/backend.py @@ -17,10 +17,10 @@ from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options -from selenium.webdriver.chrome.service import Service from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait +import chromedriver_autoinstaller # Use chromedriver-autoinstaller def bootstrap_browser( configuration: dict, ) -> webdriver.chrome.webdriver.WebDriver: @@ -34,17 +34,21 @@ def bootstrap_browser( # Set Chromium options. options = Options() options.add_experimental_option('excludeSwitches', ['enable-logging']) - options.add_experimental_option( 'detach', True) + options.add_experimental_option('detach', True) options.add_argument("--lang=en-US") # Force the browser window into English so we can find the code XPATH # If you want to run the program without the browser opening then remove the # from the options below #options.add_argument('--headless') #options.add_argument('--log-level=1') - # Get and initialize the most up-to-date Chromium web driver - driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options) + # Automatically install the correct version of ChromeDriver + chromedriver_autoinstaller.install() + + # Initialize the WebDriver with the Chromium service + driver = webdriver.Chrome(options=options) logger.debug('Starting Chromium browser') - #Blocking various Discord analytics/monitoring URLS so they don't phone home + + # Blocking various Discord analytics/monitoring URLs so they don't phone home driver.execute_cdp_cmd('Network.setBlockedURLs', { 'urls': [ 'a.nel.cloudflare.com/report', @@ -54,6 +58,7 @@ def bootstrap_browser( ] }) logger.debug('Blocking telemetry URLs') + # Enable the network connectivity of the browser driver.execute_cdp_cmd('Network.enable', {}) @@ -70,7 +75,7 @@ def bootstrap_browser( logger.debug(f'Going to landing page: {landing_url}') # Go to the required Discord login/landing page - + # Wait 1 second before typing the email and password driver.implicitly_wait(1)