From 11ab5f47405f3819e3961fe96adf58a1a70ce542 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 9 May 2023 12:29:30 +0800 Subject: [PATCH] fix for urbtix survey at 2023-05-09 --- chrome_tixcraft.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index 43a08ce..f3d02f5 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -54,7 +54,7 @@ import itertools import ssl ssl._create_default_https_context = ssl._create_unverified_context -CONST_APP_VERSION = u"MaxBot (2023.05.02)" +CONST_APP_VERSION = u"MaxBot (2023.05.08)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" @@ -6818,7 +6818,12 @@ def urbtix_auto_survey(driver, config_dict): break if question_answer_char == '0': + is_match_none = False if '沒有' in option_content_div_text: + is_match_none = True + 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') if is_radio_clicked: if show_debug_message: @@ -6830,13 +6835,24 @@ def urbtix_auto_survey(driver, config_dict): if int_answer_char > 1: for i in range(int_answer_char-1): for answer_item in synonyms(str(i+1)): - if answer_item + '個或以上' in option_content_div_text: - is_radio_clicked = force_press_button(each_option_div, By.CSS_SELECTOR, 'div.radio-wrapper') - if is_radio_clicked: - if show_debug_message: - print("fill answer:", answer_item + '個或以上') - question_answered = True - break + is_match_more_then = False + if answer_item + '個或以上' in option_content_div_text: + is_match_more_then = True + if answer_item + '個以上' in option_content_div_text: + is_match_more_then = True + if '多於' in option_content_div_text and answer_item + '個' in option_content_div_text: + is_match_more_then = True + if '更多' in option_content_div_text and answer_item + '個' in option_content_div_text: + is_match_more_then = True + 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') + if is_radio_clicked: + if show_debug_message: + print("fill answer:", answer_item + '個或以上') + question_answered = True + break if question_answered: break