获取上传页面线路测量时间。

This commit is contained in:
2026-02-10 17:40:50 +08:00
parent da7a6dd045
commit e0b36aebd3
46 changed files with 68733 additions and 16656 deletions

View File

@@ -129,14 +129,33 @@ def update_device_info(account_id, device_name, device_port, device_ip):
# =======================
def start_appium():
print("🚀 启动 Appium Server ...")
appium_port = 4723
print(f"🚀 启动 Appium Server端口 {appium_port}...")
subprocess.Popen(
["appium.cmd", "-a", "127.0.0.1", "-p", "4723"],
["appium.cmd", "-a", "127.0.0.1", "-p", str(appium_port)],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
time.sleep(5) # 给 Appium 启动时间
print("✅ Appium Server 已启动")
# 检查端口是否就绪替代固定sleep
max_wait = 30 # 最大等待30秒
start_time = time.time()
while time.time() - start_time < max_wait:
try:
# 尝试连接Appium端口验证是否就绪
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(1)
result = sock.connect_ex(("127.0.0.1", appium_port))
sock.close()
if result == 0: # 端口就绪
print(f"✅ Appium Server 启动成功(端口 {appium_port}")
return True
except Exception:
pass
time.sleep(1)
print(f"❌ Appium Server 启动超时({max_wait}秒)")
return False
# =======================