Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to google-chrome-compat #134

Merged
merged 7 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
selenium
webdriver_manager
chromedriver-autoinstaller
pyYAML
stackprinter
loguru
17 changes: 11 additions & 6 deletions src/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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',
Expand All @@ -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', {})

Expand All @@ -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)
Expand Down
Loading