bugs fixed for ticketplus.
parent
e0b6140290
commit
c6382f1b7b
|
@ -42,6 +42,11 @@ ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
# ocr
|
# ocr
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
|
# workaround for ddddocr with Pillow.
|
||||||
|
from PIL import Image
|
||||||
|
if not hasattr(Image, 'ANTIALIAS'):
|
||||||
|
setattr(Image, 'ANTIALIAS', Image.LANCZOS)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ddddocr
|
import ddddocr
|
||||||
|
|
||||||
|
@ -55,7 +60,7 @@ import webbrowser
|
||||||
|
|
||||||
import chromedriver_autoinstaller
|
import chromedriver_autoinstaller
|
||||||
|
|
||||||
CONST_APP_VERSION = "MaxBot (2023.11.15)"
|
CONST_APP_VERSION = "MaxBot (2023.11.16)"
|
||||||
|
|
||||||
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"
|
||||||
|
@ -3268,7 +3273,7 @@ def tixcraft_ticket_main_ocr(driver, config_dict, ocr, Captcha_Browser, domain_n
|
||||||
else:
|
else:
|
||||||
previous_answer = None
|
previous_answer = None
|
||||||
last_url, is_quit_bot = get_current_url(driver)
|
last_url, is_quit_bot = get_current_url(driver)
|
||||||
for redo_ocr in range(999):
|
for redo_ocr in range(99):
|
||||||
is_need_redo_ocr, previous_answer, is_form_sumbited = tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer, Captcha_Browser, ocr_captcha_image_source, domain_name)
|
is_need_redo_ocr, previous_answer, is_form_sumbited = tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer, Captcha_Browser, ocr_captcha_image_source, domain_name)
|
||||||
if is_form_sumbited:
|
if is_form_sumbited:
|
||||||
# start next loop.
|
# start next loop.
|
||||||
|
@ -10854,13 +10859,17 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
|
||||||
|
|
||||||
matched_blocks = None
|
matched_blocks = None
|
||||||
|
|
||||||
|
if show_debug_message:
|
||||||
|
print("current_layout_style:", current_layout_style)
|
||||||
|
|
||||||
area_list = None
|
area_list = None
|
||||||
try:
|
try:
|
||||||
# style 2: .text-title
|
# style 2: .text-title
|
||||||
my_css_selector = "div.rwd-margin > div.text-title"
|
my_css_selector = "div.rwd-margin > div.text-title"
|
||||||
if current_layout_style == 1:
|
if current_layout_style == 1:
|
||||||
# style 1: .text-title
|
# style 1: .text-title
|
||||||
my_css_selector = "div.v-expansion-panels > div.v-expansion-panel"
|
# PS: price info header format also is div.v-expansion-panels > div.v-expansion-panel
|
||||||
|
my_css_selector = "div.seats-area > div.v-expansion-panel"
|
||||||
area_list = driver.find_elements(By.CSS_SELECTOR, my_css_selector)
|
area_list = driver.find_elements(By.CSS_SELECTOR, my_css_selector)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
if current_layout_style == 1:
|
if current_layout_style == 1:
|
||||||
|
@ -10941,6 +10950,7 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
|
||||||
print("area_list_count is None.")
|
print("area_list_count is None.")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
is_price_panel_expanded = False
|
||||||
if not formated_area_list is None:
|
if not formated_area_list is None:
|
||||||
area_list_count = len(formated_area_list)
|
area_list_count = len(formated_area_list)
|
||||||
if show_debug_message:
|
if show_debug_message:
|
||||||
|
@ -10989,6 +10999,9 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
|
||||||
matched_blocks.append(row)
|
matched_blocks.append(row)
|
||||||
|
|
||||||
if auto_select_mode == CONST_FROM_TOP_TO_BOTTOM:
|
if auto_select_mode == CONST_FROM_TOP_TO_BOTTOM:
|
||||||
|
if ' aria-expanded="true"' in row_html:
|
||||||
|
print(row_html)
|
||||||
|
is_price_panel_expanded = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if show_debug_message:
|
if show_debug_message:
|
||||||
|
@ -11008,11 +11021,19 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
|
||||||
# for style_1, need click once.
|
# for style_1, need click once.
|
||||||
if show_debug_message:
|
if show_debug_message:
|
||||||
print("current_layout_style:", current_layout_style)
|
print("current_layout_style:", current_layout_style)
|
||||||
|
print("is_price_panel_expanded:", is_price_panel_expanded)
|
||||||
|
|
||||||
|
if not is_price_panel_expanded:
|
||||||
if current_layout_style==1:
|
if current_layout_style==1:
|
||||||
if not target_area is None:
|
if not target_area is None:
|
||||||
try:
|
try:
|
||||||
target_area.click()
|
#PS: must click on button instead of div to expand lay.
|
||||||
|
my_css_selector = 'button'
|
||||||
|
target_button = target_area.find_element(By.CSS_SELECTOR, my_css_selector)
|
||||||
|
target_button.click()
|
||||||
|
print("clicked on button.")
|
||||||
|
|
||||||
|
#target_area.click()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print("click target_area link fail")
|
print("click target_area link fail")
|
||||||
print(exc)
|
print(exc)
|
||||||
|
@ -11032,6 +11053,7 @@ def ticketplus_order_expansion_auto_select(driver, config_dict, area_keyword_ite
|
||||||
is_price_assign_by_bot = False
|
is_price_assign_by_bot = False
|
||||||
if not target_area is None:
|
if not target_area is None:
|
||||||
for retry_index in range(2):
|
for retry_index in range(2):
|
||||||
|
# PS: each price have each price div, so need pass parent div to increase ticket number.
|
||||||
is_price_assign_by_bot = ticketplus_assign_ticket_number(target_area, config_dict)
|
is_price_assign_by_bot = ticketplus_assign_ticket_number(target_area, config_dict)
|
||||||
|
|
||||||
return is_need_refresh, is_price_assign_by_bot
|
return is_need_refresh, is_price_assign_by_bot
|
||||||
|
|
Loading…
Reference in New Issue