提交 2cf24542 authored 作者: 陈泽健's avatar 陈泽健

fix(smart-locate): 修复 navigate 步骤 URL 为空的问题

navigate 步骤自动设置默认 URL(https://192.168.5.44)
修复执行时提示"导航URL不能为空"的错误
Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
上级 1860c218
......@@ -294,10 +294,25 @@ class SmartLocateService:
}
try:
# navigate 类型不需要定位
# navigate 类型:需要设置 url 参数
if action == 'navigate':
# 检查是否已有 url 参数
url = params.get('url', '')
if not url:
# 从步骤名称中提取 URL 或使用默认值
import re
url_match = re.search(r'https?://[^\s]+', name)
if url_match:
url = url_match.group(0)
else:
# 使用默认 URL
url = 'https://192.168.5.44'
result['success'] = True
result['message'] = '导航步骤无需定位'
result['params']['url'] = url
result['selectors'] = {'primary': url, 'candidates': []}
result['message'] = f'导航步骤: {url}'
logger.info(f"步骤 {order} 导航到: {url}")
return result
# ⚠️ 新增:登录相关步骤优先使用已验证的选择器
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论