diff --git a/utils/EIP_action.py b/utils/EIP_action.py index 77f321a..b31d502 100644 --- a/utils/EIP_action.py +++ b/utils/EIP_action.py @@ -125,9 +125,17 @@ class Action(): order_title, img, order_status = a_tag if order_status.text != "【已訂購】": - order_title.click() - open_page_num += 1 - time.sleep(0.05) + for attempt in range(5): + try: + order_title.click() + open_page_num += 1 + time.sleep(0.05) + break # 點成功就跳出 retry + except ElementClickInterceptedException: + print("點擊被遮蔽,重試中...") + time.sleep(0.2) # 等一下再重試 + else: + print("點擊失敗:可能被遮蔽或其他原因") if open_page_num > 0: print(f"已開啟 {open_page_num} 個訂購頁面")