时间从D盘time.txt获取。
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -453,6 +453,7 @@ def get_line_info_and_save_global(user_name: str) -> bool:
|
||||
# 存入全局字典:key=line_name,value=line_num
|
||||
global_variable.get_upload_breakpoint_dict()[line_name] = line_num
|
||||
|
||||
print(f"当前全局字典数据上传线路字典数据:{global_variable.get_upload_breakpoint_dict()}")
|
||||
# 如果line_name不在列表中,则添加
|
||||
if line_name not in global_variable.get_upload_breakpoint_list():
|
||||
global_variable.get_upload_breakpoint_list().append(line_name)
|
||||
@@ -509,3 +510,4 @@ def get_accounts_from_server(yh_id):
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"❌ JSON解析失败: {e}")
|
||||
return []
|
||||
|
||||
|
||||
@@ -48,10 +48,37 @@ def init_appium_driver(device_id, app_package="com.bjjw.cjgc", app_activity=".ac
|
||||
|
||||
try:
|
||||
# 连接Appium服务器
|
||||
driver_url = "http://127.0.0.1:4723/wd/hub"
|
||||
logging.info(f"设备 {device_id} 正在连接Appium服务器: {driver_url}")
|
||||
driver = webdriver.Remote(driver_url, options=options)
|
||||
logging.info(f"设备 {device_id} Appium服务器连接成功")
|
||||
# driver_url = "http://127.0.0.1:4723/wd/hub"
|
||||
# logging.info(f"设备 {device_id} 正在连接Appium服务器: {driver_url}")
|
||||
# driver = webdriver.Remote(driver_url, options=options)
|
||||
# logging.info(f"设备 {device_id} Appium服务器连接成功")
|
||||
driver_urls = [
|
||||
"http://127.0.0.1:4723/wd/hub", # 标准路径
|
||||
"http://127.0.0.1:4723", # 简化路径
|
||||
"http://localhost:4723/wd/hub", # localhost
|
||||
]
|
||||
|
||||
driver = None
|
||||
last_exception = None
|
||||
|
||||
# 尝试多个URL
|
||||
for driver_url in driver_urls:
|
||||
try:
|
||||
logging.info(f"设备 {device_id} 正在连接Appium服务器: {driver_url}")
|
||||
driver = webdriver.Remote(driver_url, options=options)
|
||||
logging.info(f"设备 {device_id} Appium服务器连接成功: {driver_url}")
|
||||
break # 连接成功,跳出循环
|
||||
except Exception as e:
|
||||
last_exception = e
|
||||
logging.warning(f"设备 {device_id} 连接失败 {driver_url}: {str(e)[:100]}")
|
||||
continue
|
||||
|
||||
# 检查是否连接成功
|
||||
if not driver:
|
||||
logging.error(f"设备 {device_id} 所有Appium服务器地址尝试失败")
|
||||
logging.error(f"最后错误: {str(last_exception)}")
|
||||
raise Exception(f"设备 {device_id} 无法连接到Appium服务器: {str(last_exception)}")
|
||||
|
||||
|
||||
# 初始化等待对象
|
||||
wait = WebDriverWait(driver, 20)
|
||||
@@ -679,6 +706,7 @@ def go_main_click_tabber_button(driver, device_id, tabber_button_text, max_retri
|
||||
tabber_button = driver.find_element(AppiumBy.ID, tabber_button_text)
|
||||
# 点击按钮
|
||||
tabber_button.click()
|
||||
tabber_button.click()
|
||||
logging.info(f"设备 {device_id} 已成功点击导航菜单按钮: {tabber_button_text}")
|
||||
|
||||
# 等待页面加载
|
||||
|
||||
Reference in New Issue
Block a user