添加重试
This commit is contained in:
10
actions.py
10
actions.py
@@ -122,6 +122,16 @@ class DeviceAutomation:
|
||||
def init_driver(self):
|
||||
"""初始化Appium驱动"""
|
||||
try:
|
||||
try:
|
||||
if not driver_utils.check_session_valid(self.driver, self.device_id):
|
||||
logging.warning(f"设备 {self.device_id} 会话无效,尝试重新连接驱动...")
|
||||
self.driver, self.wait = driver_utils.reconnect_driver(self.device_id, self.driver)
|
||||
if not self.driver:
|
||||
logging.error(f"设备 {self.device_id} 驱动重连失败")
|
||||
return False
|
||||
except Exception as inner_e:
|
||||
logging.warning(f"设备 {self.device_id} 检查会话状态时出错: {str(inner_e)}")
|
||||
return False
|
||||
# # 使用全局函数初始化驱动
|
||||
# self.driver, self.wait = driver_utils.init_appium_driver(self.device_id)
|
||||
# 初始化页面对象
|
||||
|
||||
Reference in New Issue
Block a user