From 98245ee18a7af880d8efd5efd26a8da0162e4c7e Mon Sep 17 00:00:00 2001 From: CHUN YU YAO Date: Tue, 7 Feb 2023 00:19:20 +0800 Subject: [PATCH] =?UTF-8?q?2023-02-05=20Cityline=20=E6=AD=A3=E5=BC=8F?= =?UTF-8?q?=E9=96=8B=E8=B3=A3=E6=99=82=E7=A8=8B=E5=BC=8F=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E9=BB=9E=E9=81=B8=E3=80=8C=E6=8C=89=E6=AD=A4?= =?UTF-8?q?=E8=B3=BC=E7=A5=A8=E3=80=8D=E6=8C=89=E9=88=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome_tixcraft.py | 33 ++++++++++++++++++++++++++++++++- settings.py | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 36b0203..0c9dd39 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -51,7 +51,7 @@ except Exception as exc: import ssl ssl._create_default_https_context = ssl._create_unverified_context -CONST_APP_VERSION = u"MaxBot (2023.02.04)" +CONST_APP_VERSION = u"MaxBot (2023.02.05)" CONST_HOMEPAGE_DEFAULT = "https://tixcraft.com" @@ -5440,6 +5440,30 @@ def check_modal_dialog_popup(driver): return ret + +def cityline_shows_goto_cta(driver): + ret = False + + el_btn = None + try: + el_btn = driver.find_element(By.CSS_SELECTOR, '.btn_cta') + except Exception as exc: + #print("find next button fail...") + #print(exc) + pass + + if el_btn is not None: + #print("bingo, found next button, start to press") + try: + if el_btn.is_enabled() and el_btn.is_displayed(): + el_btn.click() + ret = True + except Exception as exc: + print("click next button fail...") + print(exc) + + return ret + def cityline_main(driver, url, config_dict): # https://www.cityline.com/Login.html?targetUrl=https%3A%2F%2F # ignore url redirect @@ -5463,6 +5487,7 @@ def cityline_main(driver, url, config_dict): driver.switch_to.window(driver.window_handles[0]) driver.close() driver.switch_to.window(driver.window_handles[0]) + time.sleep(0.2) except Exception as excSwithFail: pass @@ -5484,6 +5509,11 @@ def cityline_main(driver, url, config_dict): if area_auto_select_enable: cityline_performance(driver, config_dict) + if '.htm' in url: + if not '/slim_end.htm' in url: + if len(url.split('/'))>=5: + cityline_shows_goto_cta(driver) + def ibon_main(driver, url, config_dict): #https://ticket.ibon.com.tw/ActivityInfo/Details/0000?pattern=entertainment if '/ActivityInfo/Details/' in url: @@ -7207,6 +7237,7 @@ def main(): if window_handles_count >= 1: driver.switch_to.window(driver.window_handles[0]) driver.switch_to.default_content() + time.sleep(0.2) else: if DISCONNECTED_MSG in driver.get_log('driver')[-1]['message']: print('quit bot by NoSuchWindowException') diff --git a/settings.py b/settings.py index 3f92e95..ca71bcd 100644 --- a/settings.py +++ b/settings.py @@ -19,7 +19,7 @@ import json import webbrowser import pyperclip -CONST_APP_VERSION = u"MaxBot (2023.02.04)" +CONST_APP_VERSION = u"MaxBot (2023.02.05)" CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom" CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"