add new condifition to refresh page.

master
CHUN YU YAO 2021-03-22 17:07:28 +08:00
parent 28c00c4ca3
commit cbc80965b6
2 changed files with 61 additions and 54 deletions

View File

@ -44,7 +44,7 @@ warnings.simplefilter('ignore',InsecureRequestWarning)
#附註1沒有寫的很好很多地方應該可以模組化。
#附註2
CONST_APP_VERSION = u"MaxBot (2021.03.21)"
CONST_APP_VERSION = u"MaxBot (2021.03.22)"
CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom"
CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"
@ -805,12 +805,16 @@ def date_auto_select(url):
#print("find .btn-next fail:", exc)
# PURPOSE: get target area list.
# RETURN:
# is_need_refresh
# areas
def get_tixcraft_target_area(el, area_keyword):
areas = None
is_need_refresh = False
areas = None
if el is not None:
area_list = None
area_list_count = 0
if el is not None:
try:
area_list = el.find_elements(By.TAG_NAME, 'a')
except Exception as exc:
@ -818,14 +822,15 @@ def get_tixcraft_target_area(el, area_keyword):
pass
if area_list is not None:
if len(area_list) == 0:
area_list_count = len(area_list)
if area_list_count == 0:
print("(with keyword) list is empty, do refresh!")
is_need_refresh = True
else:
print("(with keyword) list is None, do refresh!")
is_need_refresh = True
if area_list is not None:
if area_list_count > 0:
areas = []
for row in area_list:
row_is_enabled=False
@ -881,8 +886,10 @@ def get_tixcraft_target_area(el, area_keyword):
break
#print("row_text:" + row_text)
#print("match:" + area_keyword)
if len(areas) == 0:
areas = None
is_need_refresh = True
return is_need_refresh, areas

View File

@ -16,7 +16,7 @@ import os
import sys
import json
CONST_APP_VERSION = u"MaxBot (2021.03.21)"
CONST_APP_VERSION = u"MaxBot (2021.03.22)"
CONST_FROM_TOP_TO_BOTTOM = u"from top to bottom"
CONST_FROM_BOTTOM_TO_TOP = u"from bottom to top"