2023-07-03, add new fill form for kham
parent
9fc2a5addd
commit
85656d7899
|
@ -53,7 +53,7 @@ import webbrowser
|
||||||
import argparse
|
import argparse
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.07.01)"
|
CONST_APP_VERSION = "MaxBot (2023.07.03)"
|
||||||
|
|
||||||
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
CONST_MAXBOT_CONFIG_FILE = "settings.json"
|
||||||
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"
|
||||||
|
@ -9603,7 +9603,7 @@ def kham_performance_ticket_number(driver, config_dict):
|
||||||
|
|
||||||
return is_ticket_number_assigned
|
return is_ticket_number_assigned
|
||||||
|
|
||||||
def kham_choice_auto_seat(driver):
|
def kham_switch_to_auto_seat(driver):
|
||||||
is_switch_to_auto_seat = False
|
is_switch_to_auto_seat = False
|
||||||
|
|
||||||
btn_switch_to_auto_seat = None
|
btn_switch_to_auto_seat = None
|
||||||
|
@ -9653,6 +9653,7 @@ def kham_performance(driver, config_dict, ocr, Captcha_Browser, domain_name, mod
|
||||||
is_need_refresh = False
|
is_need_refresh = False
|
||||||
|
|
||||||
auto_fill_ticket_number = True
|
auto_fill_ticket_number = True
|
||||||
|
is_captcha_sent = False
|
||||||
if auto_fill_ticket_number:
|
if auto_fill_ticket_number:
|
||||||
area_keyword = config_dict["area_auto_select"]["area_keyword"].strip()
|
area_keyword = config_dict["area_auto_select"]["area_keyword"].strip()
|
||||||
|
|
||||||
|
@ -9688,7 +9689,7 @@ def kham_performance(driver, config_dict, ocr, Captcha_Browser, domain_name, mod
|
||||||
|
|
||||||
is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
|
is_captcha_sent = kham_captcha(driver, config_dict, ocr, Captcha_Browser, model_name)
|
||||||
|
|
||||||
return is_price_assign_by_bot
|
return is_price_assign_by_bot, is_captcha_sent
|
||||||
|
|
||||||
|
|
||||||
def kham_keyin_captcha_code(driver, answer = "", auto_submit = False):
|
def kham_keyin_captcha_code(driver, answer = "", auto_submit = False):
|
||||||
|
@ -9987,6 +9988,7 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
|
||||||
if not Captcha_Browser is None:
|
if not Captcha_Browser is None:
|
||||||
Captcha_Browser.Set_Domain(domain_name, captcha_url=captcha_url)
|
Captcha_Browser.Set_Domain(domain_name, captcha_url=captcha_url)
|
||||||
|
|
||||||
|
is_captcha_sent = False
|
||||||
if config_dict["ocr_captcha"]["enable"]:
|
if config_dict["ocr_captcha"]["enable"]:
|
||||||
is_reset_password_text = kham_check_captcha_text_error(driver, config_dict)
|
is_reset_password_text = kham_check_captcha_text_error(driver, config_dict)
|
||||||
if is_reset_password_text:
|
if is_reset_password_text:
|
||||||
|
@ -9994,8 +9996,28 @@ def kham_main(driver, url, config_dict, ocr, Captcha_Browser):
|
||||||
|
|
||||||
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
|
is_button_clicked = force_press_button(driver, By.CSS_SELECTOR,'div.ui-dialog-buttonset > button.ui-button')
|
||||||
if config_dict["area_auto_select"]["enable"]:
|
if config_dict["area_auto_select"]["enable"]:
|
||||||
is_switch_to_auto_seat = kham_choice_auto_seat(driver)
|
is_switch_to_auto_seat = kham_switch_to_auto_seat(driver)
|
||||||
is_price_assign_by_bot = kham_performance(driver, config_dict, ocr, Captcha_Browser, domain_name, model_name)
|
is_price_assign_by_bot, is_captcha_sent = kham_performance(driver, config_dict, ocr, Captcha_Browser, domain_name, model_name)
|
||||||
|
|
||||||
|
# this is a special case, not performance_price_area_id, directly input ticket_nubmer in #amount.
|
||||||
|
is_ticket_number_assigned = kham_performance_ticket_number(driver, config_dict)
|
||||||
|
if show_debug_message:
|
||||||
|
print("is_ticket_number_assigned:", is_ticket_number_assigned)
|
||||||
|
print("is_captcha_sent:", is_captcha_sent)
|
||||||
|
if is_ticket_number_assigned:
|
||||||
|
if is_captcha_sent:
|
||||||
|
el_btn = None
|
||||||
|
my_css_selector = '#addcart'
|
||||||
|
try:
|
||||||
|
el_btn = driver.find_element(By.CSS_SELECTOR, my_css_selector)
|
||||||
|
if not el_btn is None:
|
||||||
|
el_btn.click()
|
||||||
|
except Exception as exc:
|
||||||
|
if show_debug_message:
|
||||||
|
print("find addcart button fail")
|
||||||
|
print(exc)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
#https://kham.com.tw/application/UTK02/UTK0205_.aspx?PERFORMANCE_ID=XXX&GROUP_ID=30&PERFORMANCE_PRICE_AREA_ID=XXX
|
#https://kham.com.tw/application/UTK02/UTK0205_.aspx?PERFORMANCE_ID=XXX&GROUP_ID=30&PERFORMANCE_PRICE_AREA_ID=XXX
|
||||||
if '.aspx?performance_id=' in url.lower() and 'performance_price_area_id=' in url.lower():
|
if '.aspx?performance_id=' in url.lower() and 'performance_price_area_id=' in url.lower():
|
||||||
|
|
Loading…
Reference in New Issue