Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
SenZmaKi committed Jun 29, 2024
1 parent 60c5c0b commit d93e432
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
with:
install-chromedriver: true
- run: |
echo ${{ steps.setup-chrome.outputs.chrome-path }}
echo ${{ steps.setup-chrome.outputs.chromedriver-path }}
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
echo "CHROME_DRIVER_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> $GITHUB_ENV
- name: Test Pahe
id: test_pahe
Expand Down
12 changes: 10 additions & 2 deletions senpwai/common/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from selenium.common.exceptions import NoSuchDriverException
from selenium.webdriver.chromium.options import ChromiumOptions
from selenium.webdriver.common.options import ArgOptions
import os


class BrowserName(Enum):
Expand Down Expand Up @@ -64,14 +65,17 @@ def setup_options(options: ArgOptions):
options.add_argument("--disable-extensions")
options.add_argument("--disable-infobars")
options.add_argument("--no-sandbox")
# Doesn't work for some reason reference HACK:
# Doesn't work for some reason reference HACK:
# options.add_argument("--log-level=3")
if isinstance(options, FirefoxOptions):
if headless:
options.add_argument("--headless")
if isinstance(options, ChromiumOptions):
# HACK: https://github.com/SeleniumHQ/selenium/issues/13095#issuecomment-1793310460
# options.add_experimental_option("excludeSwitches", ["enable-logging"])
chrome_path = os.getenv("CHROME_PATH", None)
print("Chrome path:", chrome_path)
options.binary_location = chrome_path
pass
else:
if headless:
Expand All @@ -86,7 +90,11 @@ def helper(browser_name: BrowserName):
options = cast(EdgeOptions, setup_options(EdgeOptions()))
self.driver = Edge(service=service_edge, options=options)
case BrowserName.chrome:
service_chrome = ChromeService()
chrome_driver_path = os.getenv("CHROME_DRIVER_PATH", None)
print("Chrome driver path:", chrome_driver_path)
service_chrome = ChromeService(
executable_path=chrome_driver_path
)
options = cast(ChromeOptions, setup_options(ChromeOptions()))
self.driver = Chrome(service=service_chrome, options=options)
case BrowserName.firefox:
Expand Down

0 comments on commit d93e432

Please sign in to comment.