2024-04-12, update for kktix bus ticket.

master
Your Name 2024-04-26 18:01:09 +08:00
parent 1ac2c8aa7e
commit 0c7d384325
4 changed files with 24 additions and 31 deletions

View File

@ -44,7 +44,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.04.11)" CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -2422,25 +2422,30 @@ def kktix_press_next_button(driver):
button_count = len(but_button_list) button_count = len(but_button_list)
#print("button_count:",button_count) #print("button_count:",button_count)
if button_count > 0: if button_count > 0:
btn = but_button_list[button_count-1]
try: try:
#print("click on last button:", button_count) driver.set_script_timeout(0.1)
but_button_list[button_count-1].click() driver.execute_script("arguments[0].focus();", btn)
time.sleep(0.3)
ret = True ret = True
except Exception as exc: except Exception as exc:
print(exc)
pass pass
for retry_idx in range(4):
try:
#print("click on last button:", button_count)
btn.click()
time.sleep(0.2)
ret = True
except Exception as exc:
print(exc)
pass
if ret:
break
return ret return ret
def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kktix_area_keyword): def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kktix_area_keyword):
show_debug_message = True # debug. show_debug_message = config_dict["advanced"]["verbose"]:
show_debug_message = False # online
if config_dict["advanced"]["verbose"]:
show_debug_message = True
ticket_number = config_dict["ticket_number"] ticket_number = config_dict["ticket_number"]
areas = None areas = None
@ -2645,11 +2650,7 @@ def kktix_travel_price_list(driver, config_dict, kktix_area_auto_select_mode, kk
return is_dom_ready, is_ticket_number_assigned, areas return is_dom_ready, is_ticket_number_assigned, areas
def kktix_assign_ticket_number(driver, config_dict, kktix_area_keyword): def kktix_assign_ticket_number(driver, config_dict, kktix_area_keyword):
show_debug_message = True # debug. show_debug_message = config_dict["advanced"]["verbose"]:
show_debug_message = False # online
if config_dict["advanced"]["verbose"]:
show_debug_message = True
ticket_number_str = str(config_dict["ticket_number"]) ticket_number_str = str(config_dict["ticket_number"])
auto_select_mode = config_dict["area_auto_select"]["mode"] auto_select_mode = config_dict["area_auto_select"]["mode"]
@ -2708,11 +2709,7 @@ def kktix_assign_ticket_number(driver, config_dict, kktix_area_keyword):
def kktix_check_agree_checkbox(driver, config_dict): def kktix_check_agree_checkbox(driver, config_dict):
show_debug_message = True # debug. show_debug_message = config_dict["advanced"]["verbose"]:
show_debug_message = False # online
if config_dict["advanced"]["verbose"]:
show_debug_message = True
is_finish_checkbox_click = False is_finish_checkbox_click = False
is_dom_ready = False is_dom_ready = False
@ -2833,11 +2830,7 @@ def set_kktix_control_label_text(driver, config_dict):
def kktix_reg_captcha(driver, config_dict, fail_list, registrationsNewApp_div): def kktix_reg_captcha(driver, config_dict, fail_list, registrationsNewApp_div):
show_debug_message = True # debug. show_debug_message = config_dict["advanced"]["verbose"]:
show_debug_message = False # online
if config_dict["advanced"]["verbose"]:
show_debug_message = True
answer_list = [] answer_list = []
@ -2876,7 +2869,7 @@ def kktix_reg_captcha(driver, config_dict, fail_list, registrationsNewApp_div):
# due multi next buttons(pick seats/best seats) # due multi next buttons(pick seats/best seats)
kktix_press_next_button(driver) kktix_press_next_button(driver)
time.sleep(0.75) time.sleep(0.5)
fail_list.append(inferred_answer_string) fail_list.append(inferred_answer_string)
#print("new fail_list:", fail_list) #print("new fail_list:", fail_list)

View File

@ -24,7 +24,7 @@ import webbrowser
import util import util
CONST_APP_VERSION = "MaxBot (2024.04.11)" CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -32,7 +32,7 @@ except Exception as exc:
print(exc) print(exc)
pass pass
CONST_APP_VERSION = "MaxBot (2024.04.11)" CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"

View File

@ -34,7 +34,7 @@ try:
except Exception as exc: except Exception as exc:
pass pass
CONST_APP_VERSION = "MaxBot (2024.04.11)" CONST_APP_VERSION = "MaxBot (2024.04.12)"
CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt"
CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_CONFIG_FILE = "settings.json"
@ -670,7 +670,7 @@ def get_default_config():
config_dict["advanced"]["user_guess_string"] = "" config_dict["advanced"]["user_guess_string"] = ""
config_dict["advanced"]["remote_url"] = "http://127.0.0.1:%d/" % (CONST_SERVER_PORT) config_dict["advanced"]["remote_url"] = "http://127.0.0.1:%d/" % (CONST_SERVER_PORT)
config_dict["advanced"]["auto_reload_page_interval"] = 0.2 config_dict["advanced"]["auto_reload_page_interval"] = 0.1
config_dict["advanced"]["reset_browser_interval"] = 0 config_dict["advanced"]["reset_browser_interval"] = 0
config_dict["advanced"]["kktix_status_api"] = False config_dict["advanced"]["kktix_status_api"] = False
config_dict["advanced"]["max_dwell_time"] = 60 config_dict["advanced"]["max_dwell_time"] = 60