2022-11-09, fix stale element reference: element is not attached to the page document.
parent
24f59119ed
commit
d8056046f2
|
@ -953,7 +953,14 @@ def tixcraft_home(driver):
|
|||
pass
|
||||
|
||||
if accept_all_cookies_btn is not None:
|
||||
is_visible = False
|
||||
try:
|
||||
if accept_all_cookies_btn.is_enabled() and accept_all_cookies_btn.is_displayed():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if is_visible:
|
||||
try:
|
||||
accept_all_cookies_btn.click()
|
||||
except Exception as exc:
|
||||
|
@ -972,7 +979,15 @@ def tixcraft_home(driver):
|
|||
if close_all_alert_btns is not None:
|
||||
#print('alert count:', len(close_all_alert_btns))
|
||||
for alert_btn in close_all_alert_btns:
|
||||
# fix bug: Message: stale element reference: element is not attached to the page document
|
||||
is_visible = False
|
||||
try:
|
||||
if alert_btn.is_enabled() and alert_btn.is_displayed():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if is_visible:
|
||||
try:
|
||||
alert_btn.click()
|
||||
except Exception as exc:
|
||||
|
@ -1582,7 +1597,14 @@ def tixcraft_verify(driver, url):
|
|||
is_submited = False
|
||||
for i in range(3):
|
||||
if form_input is not None:
|
||||
is_visible = False
|
||||
try:
|
||||
if form_input.is_enabled():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if is_visible:
|
||||
try:
|
||||
form_input.click()
|
||||
is_submited = True
|
||||
|
@ -1700,7 +1722,14 @@ def kktix_events_press_next_button(driver):
|
|||
pass
|
||||
|
||||
if not next_step_button is None:
|
||||
is_visible = False
|
||||
try:
|
||||
if next_step_button.is_enabled():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if is_visible:
|
||||
try:
|
||||
driver.execute_script("arguments[0].click();", next_step_button)
|
||||
ret = True
|
||||
|
@ -1737,7 +1766,14 @@ def kktix_press_next_button(driver):
|
|||
#pass
|
||||
|
||||
if not next_step_button is None:
|
||||
is_visible = False
|
||||
try:
|
||||
if next_step_button.is_enabled():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if is_visible:
|
||||
try:
|
||||
driver.execute_script("arguments[0].click();", next_step_button)
|
||||
ret = True
|
||||
|
@ -1890,7 +1926,6 @@ def kktix_assign_ticket_number(driver, ticket_number, kktix_area_keyword, kktix_
|
|||
area = areas[target_row_index]
|
||||
|
||||
if area is not None:
|
||||
try:
|
||||
#print("area text", area.text)
|
||||
ticket_price_input = None
|
||||
try:
|
||||
|
@ -1928,11 +1963,6 @@ def kktix_assign_ticket_number(driver, ticket_number, kktix_area_keyword, kktix_
|
|||
#print(exc)
|
||||
pass
|
||||
|
||||
except Exception as exc:
|
||||
print("auto fill ticket number fail")
|
||||
print(exc)
|
||||
pass
|
||||
|
||||
return ret
|
||||
|
||||
def kktix_get_web_datetime(url, registrationsNewApp_div):
|
||||
|
@ -2819,6 +2849,13 @@ def fami_activity(driver, url):
|
|||
fami_start_to_buy_button = None
|
||||
fami_start_to_buy_button = driver.find_element(By.ID, 'buyWaiting')
|
||||
if fami_start_to_buy_button is not None:
|
||||
is_visible = False
|
||||
try:
|
||||
if fami_start_to_buy_button.is_enabled():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if fami_start_to_buy_button.is_enabled():
|
||||
try:
|
||||
fami_start_to_buy_button.click()
|
||||
|
@ -2899,7 +2936,14 @@ def fami_home(driver, url):
|
|||
my_css_selector = "div.col > a.btn"
|
||||
fami_assign_site_button = driver.find_element(By.CSS_SELECTOR, my_css_selector)
|
||||
if fami_assign_site_button is not None:
|
||||
is_visible = False
|
||||
try:
|
||||
if fami_assign_site_button.is_enabled():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if is_visible:
|
||||
try:
|
||||
fami_assign_site_button.click()
|
||||
except Exception as exc:
|
||||
|
@ -2938,7 +2982,14 @@ def fami_home(driver, url):
|
|||
|
||||
if area_target is not None:
|
||||
#print("area text", area_target.text)
|
||||
is_visible = False
|
||||
try:
|
||||
if area_target.is_enabled():
|
||||
is_visible = True
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if is_visible:
|
||||
try:
|
||||
area_target.click()
|
||||
except Exception as exc:
|
||||
|
|
Loading…
Reference in New Issue