diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 561ca80..5d88d79 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -44,7 +44,7 @@ except Exception as exc: print(exc) pass -CONST_APP_VERSION = "MaxBot (2024.03.26)" +CONST_APP_VERSION = "MaxBot (2024.03.27)" CONST_MAXBOT_ANSWER_ONLINE_FILE = "MAXBOT_ONLINE_ANSWER.txt" CONST_MAXBOT_CONFIG_FILE = "settings.json" @@ -859,7 +859,7 @@ def force_press_button_iframe(driver, f, select_by, select_query, force_submit=T except Exception as exc: pass - is_clicked = force_press_button(driver, select_by, select_query, force_submit) + is_clicked = press_button(driver, select_by, select_query, force_submit) if f: # switch back to main content, otherwise we will get StaleElementReferenceException @@ -902,7 +902,7 @@ selectSoldoutItems.forEach((eachItem) => #print(exc) pass -def force_press_button(driver, select_by, select_query, force_submit=True): +def press_button(driver, select_by, select_query, force_submit=True): ret = False next_step_button = None try: @@ -1148,7 +1148,7 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name): if show_debug_message: print("target_area got, start to press button.") - is_date_clicked = force_press_button(target_area, By.CSS_SELECTOR,'button') + is_date_clicked = press_button(target_area, By.CSS_SELECTOR,'button') if not is_date_clicked: if show_debug_message: print("press button fail, try to click hyperlink.") @@ -1172,7 +1172,7 @@ def tixcraft_date_auto_select(driver, url, config_dict, domain_name): # for: ticketmaster.sg - is_date_clicked = force_press_button(target_area, By.CSS_SELECTOR,'a') + is_date_clicked = press_button(target_area, By.CSS_SELECTOR,'a') # [PS]: current reload condition only when if auto_reload_coming_soon_page_enable: @@ -1297,7 +1297,7 @@ def ticketmaster_date_auto_select(driver, url, config_dict, domain_name): is_date_clicked = False if not target_area is None: - is_date_clicked = force_press_button(target_area, By.CSS_SELECTOR,'a') + is_date_clicked = press_button(target_area, By.CSS_SELECTOR,'a') if is_date_clicked: try: window_handles_count = len(driver.window_handles) @@ -1809,7 +1809,7 @@ def fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_li form_input_1.send_keys(Keys.ENTER) is_button_clicked = True if len(next_step_button_css) > 0: - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, next_step_button_css) + is_button_clicked = press_button(driver, By.CSS_SELECTOR, next_step_button_css) except Exception as exc: if show_debug_message: print(exc) @@ -1854,7 +1854,7 @@ def fill_common_verify_form(driver, config_dict, inferred_answer_string, fail_li is_button_clicked = False form_input_2.send_keys(Keys.ENTER) if len(next_step_button_css) > 0: - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, next_step_button_css) + is_button_clicked = press_button(driver, By.CSS_SELECTOR, next_step_button_css) if is_button_clicked: is_answer_sent = True @@ -2142,10 +2142,12 @@ def tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer, C return is_need_redo_ocr, previous_answer, is_form_sumbited def tixcraft_ticket_main_agree(driver, config_dict): + is_finish_checkbox_click = False for i in range(3): is_finish_checkbox_click = check_checkbox(driver, By.CSS_SELECTOR, '#TicketForm_agree') if is_finish_checkbox_click: break + return is_finish_checkbox_click def get_tixcraft_ticket_select_by_keyword(driver, config_dict, area_keyword_item): show_debug_message = True # debug. @@ -2401,7 +2403,7 @@ def kktix_confirm_order_button(driver): # : 2: /events/xxx/registrations/new # : This is ONLY for case-1, because case-2 lenght >5 def kktix_events_press_next_button(driver): - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'.tickets > a.btn-point') + is_button_clicked = press_button(driver, By.CSS_SELECTOR,'.tickets > a.btn-point') return is_button_clicked # : This is for case-2 next button. @@ -4703,7 +4705,7 @@ def cityline_purchase_button_press(driver, config_dict): is_button_clicked = False if is_date_assign_by_bot: - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'button.purchase-btn') + is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'button.purchase-btn') return is_button_clicked @@ -5207,7 +5209,7 @@ def ibon_performance(driver, config_dict): return is_price_assign_by_bot def ibon_purchase_button_press(driver): - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, '#ticket-wrap > a.btn') + is_button_clicked = press_button(driver, By.CSS_SELECTOR, '#ticket-wrap > a.btn') return is_button_clicked def assign_text(driver, by, query, val, overwrite = False, submit=False, overwrite_when = ""): @@ -5355,7 +5357,7 @@ def cityline_login(driver, account, password): # press "click here" use password to login. if is_email_sent: - is_click_here_pressed = force_press_button(driver, By.CSS_SELECTOR,'.otp-box > ul > li:nth-child(3) > a') + is_click_here_pressed = press_button(driver, By.CSS_SELECTOR,'.otp-box > ul > li:nth-child(3) > a') is_password_sent = False if is_email_sent: @@ -5482,7 +5484,7 @@ def kham_login(driver, account, password): pass if is_password_sent: - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.memberContent > p > a > button.red') + is_button_clicked = press_button(driver, By.CSS_SELECTOR,'div.memberContent > p > a > button.red') ret = is_password_sent @@ -5543,7 +5545,7 @@ def ticket_login(driver, account, password): pass if is_password_sent: - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'input[value="登入"]') + is_button_clicked = press_button(driver, By.CSS_SELECTOR,'input[value="登入"]') ret = is_password_sent @@ -5899,7 +5901,7 @@ def ticketmaster_assign_ticket_number(driver, config_dict): # must wait ticket number assign to focus captcha. if is_ticket_number_assigned: - is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'#autoMode') + is_button_clicked = press_button(driver, By.CSS_SELECTOR,'#autoMode') def ticketmaster_captcha(driver, config_dict, ocr, Captcha_Browser, domain_name): show_debug_message = True # debug. @@ -6432,7 +6434,7 @@ def urbtix_auto_survey(driver, config_dict): if question_direction in ['left','right']: for answer_item in util.synonym_dict(question_answer_char): if answer_item in option_content_div_text: - is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') + is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') if is_radio_clicked: if show_debug_message: print("fill answer:", answer_item) @@ -6442,7 +6444,7 @@ def urbtix_auto_survey(driver, config_dict): if question_direction == "count": for answer_item in util.synonym_dict(question_answer_char): if answer_item in option_content_div_text: - is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') + is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') if is_radio_clicked: if show_debug_message: print("fill answer:", answer_item) @@ -6456,7 +6458,7 @@ def urbtix_auto_survey(driver, config_dict): if 'LESS THEN ONE' in option_content_div_text.upper(): is_match_none = True if is_match_none: - is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') + is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') if is_radio_clicked: if show_debug_message: print("fill answer:", '沒有') @@ -6479,7 +6481,7 @@ def urbtix_auto_survey(driver, config_dict): if 'MORE THEN' in option_content_div_text.upper() and answer_item + '個' in option_content_div_text: is_match_more_then = True if is_match_more_then: - is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') + is_radio_clicked = press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') if is_radio_clicked: if show_debug_message: print("fill answer:", answer_item + '個或以上') @@ -6520,7 +6522,7 @@ def urbtix_auto_survey(driver, config_dict): if questions_remain_text == "0" or questions_remain_text == "": is_button_clicked = False - #is_button_clicked = force_press_button(driver, By.CSS_SELECTOR, 'div.button-wrapper > div.button-text-multi-lines > div') + #is_button_clicked = press_button(driver, By.CSS_SELECTOR, 'div.button-wrapper > div.button-text-multi-lines > div') # Message: Element
is not clickable at point (351,566) because another element