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

Fix bug "This version of ChromeDriver only supports Chrome version 114" #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 12 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from undetected_chromedriver import ChromeOptions, Chrome
from PIL import ImageGrab, Image
from threading import Thread

from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import urllib.request
import undetected_chromedriver as webdriver


class Zefoy:
Expand Down Expand Up @@ -92,7 +95,14 @@ def display_banner(self) -> str:
return display_banner + f'\n {second_color}Plati ~ discord.gg/onplx\n'

def setup_driver(self) -> Chrome:
return Chrome(ChromeOptions().add_argument('detach'))
try:
service = Service(ChromeDriverManager().install())
except ValueError:
latest_chromedriver_version_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
latest_chromedriver_version = urllib.request.urlopen(latest_chromedriver_version_url).read().decode('utf-8')
service = Service(ChromeDriverManager(version=latest_chromedriver_version).install())
driver_executable_path = service.path
return Chrome(options=ChromeOptions().add_argument('detach'), driver_executable_path=driver_executable_path)

def convert(self, minutes: int, seconds: int) -> int:
return minutes * 60 + seconds + 3
Expand Down