feat(core): load element XPath maps in aiAct - #2933
Draft
quanruzhuoxiu wants to merge 5 commits into
Draft
Conversation
Deploying midscene with
|
| Latest commit: |
9f0ebf3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f4b65cc4.midscene.pages.dev |
| Branch Preview URL: | https://feat-ai-act-load-element-xpa.midscene.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
loadElementXpathstoaiActfor loading name-to-XPath maps from YAMLYAML
Validation
pnpm run lintpnpm --filter @midscene/core exec vitest --run tests/unit-test/agent-context-option.test.ts tests/unit-test/element-xpaths.test.ts tests/unit-test/utils.test.ts tests/unit-test/player-action-dispatch.test.ts tests/unit-test/ai-act-extra-actions.test.ts tests/unit-test/extra-actions.test.ts(81 passed)pnpm exec nx build @midscene/corepnpm exec nx build @midscene/webAI_TEST_TYPE=web pnpm --filter @midscene/web exec vitest --run tests/ai/web/puppeteer/element-xpaths-benchmark.test.tsAI_TEST_TYPE=web pnpm --filter @midscene/web exec vitest --run tests/ai/web/puppeteer/element-xpath-dense-benchmark.test.tsBoth AI benchmarks are gated and skip unless their explicit benchmark variant is selected.
Controlled form benchmark
Two successful runs per variant used the same local page, prompt, model, retry count, and disabled cache. Only
loadElementXpathschanged.All six locator-required actions changed from planner coordinate hits to
User expected pathXPath hits. No Locate task contained model usage in the mapped runs. Call count stayed unchanged because coordinate grounding is part of the same per-action planning calls in this setup.Dense-table small-model benchmark
The fixture contains 24 invoice rows and four icon-only actions per row (96 candidates). The formal task is one atomic click on the offscreen
INV-1161edit action. The XPath variant receives the complete 96-item map, not an answer-only hint. Cache, retry, deep thinking, and reasoning are disabled, and the page records every actual click for strict DOM assertions.qwen3.5-27bsucceeded on all five stratified baseline tasks, so it did not reproduce inaccurate target localization. Per the experiment rule, the repeated formal comparison usedqwen3-vl-flash:Every successful target locate used
hitBy.from = User expected pathand the expected XPath forINV-1161. Auxiliary planning may still use AI Locate for scrolling; the assertion specifically proves that target-element grounding used the supplied XPath. Token and duration totals are not compared between these formal variants because each baseline aborted after its first model response.Full methodology, source excerpts, per-run metrics, SHA-256 digests, and six hosted Midscene HTML reports are in the standalone experiment document.
CI
1d4481793702903f2d5fb828aa4e734c1e369385: 16/16 checks passed.