Skip to content

Commit

Permalink
Edge added
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehmet Cagri Aksoy committed Mar 25, 2024
1 parent dcae4f4 commit ac22f95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
25 changes: 4 additions & 21 deletions src/DriverSetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,14 @@
@author: Mehmet Çağrı Aksoy
"""

import time

from selenium.webdriver import ChromeOptions, Chrome
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
from selenium.webdriver import Edge
from selenium.webdriver.edge.service import Service as EdgeService
from webdriver_manager.microsoft import EdgeChromiumDriverManager


class DriverSetting:
"""Driver'ı ayarlar."""

def driver_init(self):
"""Driver'ı ayarlar."""
options = ChromeOptions()
# chrome_options.headless = False
options.add_argument("--no-sandbox")
options.add_argument("--window-size=320,480")
# options.add_argument('--headless')
options.add_argument("--disable-gpu")
# options.add_argument('--disable-blink-features=AutomationControlled')
# options.add_experimental_option("detach", True)
options.add_experimental_option("excludeSwitches", ["enable-logging"])
try:
driver = Chrome(ChromeDriverManager().install(), options=options)
except:
time.sleep(1) # 1 saniye bekle!
driver = Chrome(options=options)

driver = Edge(service=EdgeService(EdgeChromiumDriverManager().install()))
return driver
11 changes: 8 additions & 3 deletions src/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def control(driver, time, delay_time, telegram_msg, bot_token, chat_id, ses):
# Telegram mesaji gonder!
if telegram_msg:
TelegramMsg.TelegramMsg().send_telegram_message(bot_token, chat_id)
"""
sg.Popup(
"Hey Orada mısın? Biletin bulundu. Satın alabilirsin",
keep_on_top=True,
button_type=5,
)
"""

elif response == ErrCodes.TEKRAR_DENE:
print("\n" + str(delay_time) + " Dakika icerisinde tekrar denenecek...")
mixer.music.load(path.abspath("sound/beep.mp3"))
Expand All @@ -78,7 +78,7 @@ def control(driver, time, delay_time, telegram_msg, bot_token, chat_id, ses):
window["Durdur!"].update(disabled=True)

# Chrome'u kapat!
kill_chrome()
# kill_chrome()

# GUI Ayarlari
font = ("Verdana", 10)
Expand All @@ -89,6 +89,11 @@ def control(driver, time, delay_time, telegram_msg, bot_token, chat_id, ses):
now = datetime.now()
currentTime = now.strftime("%H:%M")

sg.popup(
"Selam :)",
"Ilk defa kullaniyorsaniz, ilk taramada biraz bekleyebilirsiniz!",
keep_on_top=True,
)
layout = [
[
[
Expand Down

0 comments on commit ac22f95

Please sign in to comment.