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

fix(frontend): 修复智能定位不处理 navigate 步骤的问题

1. 取消过滤 navigate 步骤,允许发送到智能定位 API
2. 正确更新步骤参数:合并 params 而非只更新 selector
3. 支持 navigate 步骤的 url 参数自动填充
Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
上级 2cf24542
...@@ -998,9 +998,9 @@ const batchLocate = async () => { ...@@ -998,9 +998,9 @@ const batchLocate = async () => {
return return
} }
// 2. 转换步骤为智能定位格式 // 2. 转换步骤为智能定位格式(包含 navigate 步骤)
const smartLocateSteps = steps const smartLocateSteps = steps
.filter((s: any) => s.action && s.action !== 'navigate') .filter((s: any) => s.action)
.map((s: any) => ({ .map((s: any) => ({
order: s.order, order: s.order,
name: s.name || '', name: s.name || '',
...@@ -1029,15 +1029,20 @@ const batchLocate = async () => { ...@@ -1029,15 +1029,20 @@ const batchLocate = async () => {
const locateResult = result.results.find( const locateResult = result.results.find(
(r: any) => r.order === s.order && r.success (r: any) => r.order === s.order && r.success
) )
if (locateResult && locateResult.selectors?.primary) { if (locateResult) {
const updatedParams = {
...(s.params || {}),
...(locateResult.params || {}),
}
// 如果有 selector,更新选择器
if (locateResult.selectors?.primary) {
updatedParams.selector = locateResult.selectors.primary
}
return { return {
...s, ...s,
params: { params: updatedParams,
...(s.params || {}),
selector: locateResult.selectors.primary,
},
locator_type: 'css', locator_type: 'css',
locator_value: locateResult.selectors.primary, locator_value: locateResult.selectors?.primary || '',
} }
} }
return s return s
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论