execute_script turns string args into elements when they happen to match one element
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 50/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- api
Direzione di ricerca
The argument handling is in src/tools/execute-script.tool.ts around lines 40-50, where each string argument is run through $ and swapped for an element when it matches exactly one node. Start there and in the tool's input schema to see how args is defined. Get a maintainer decision on the explicit form (an index list versus { selector } objects) before editing, since the proposal is open and this is a behaviour change. Done means plain strings always pass through unchanged and any deprecation path is documented.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Target: feature/v5 (breaking change, no v4 stopgap).
Problem. execute_script checks every string argument against the page as a selector, and passes an element instead of the string whenever the selector matches exactly one element (src/tools/execute-script.tool.ts:40-55). With WebdriverIO v10's strict $, more than one match throws, which is caught, so the string survives. The result depends on the page, not on what the caller meant:
| Call | Page | The script receives |
|---|---|---|
args: ['main'] |
one <main> |
an element |
args: ['main'] |
no <main> |
the string 'main' |
args: ['a'] |
one link | an element |
args: ['a'] |
several links | the string 'a' |
Words such as main, h1, form, nav, table or #total collide with real pages, so the same tool call behaves differently on different pages. Each candidate also costs a WebDriver round trip.
Proposal. Make it explicit: { selector: '…' } objects in args. Plain strings always stay strings. This is a breaking change, so it ships in v5 with no v4 deprecation path. docs/architecture/v5-proposal.md:180 keeps execute_script as a direct tool on top of session's exec; if v5 routes it through exec instead, the fix follows that decision.
Acceptance
args: ['main']stays a string on a page with one<main>.- Zero
$calls for string arguments. - The README
execute_scriptrow (README.md:755) and a changelog entry describe the object form.
- Lingua principale
- TypeScript
- Stelle
- 45
- Fork
- 20
- Merge medio
- 2g 9h
- PR unite (30g)
- 16
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di webdriverio/mcp
-
Issue templates with a required 'MCP client' fieldForse già presa @Winify l’ha presa 4 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
webdriverio/mcp#208 ·
I maintainer di solito rispondono entro 2 giorni
-
v5: record per-step code from the @wdio/session agent history and drop MCP's per-action templatesAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
webdriverio/mcp#214 ·
I maintainer di solito rispondono entro 2 giorni
-
Generated code skips switch_context, rotate_device, hide_keyboard, switch_tab and emulate_deviceForse già presa @VB-Blue l’ha presa 2 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
webdriverio/mcp#213 ·
I maintainer di solito rispondono entro 2 giorni
-
WDIO_MCP_TOOLS=code: a fixed code-mode tool set (session, navigate, snapshot, query_docs, run_code)Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
webdriverio/mcp#212 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
webdriverio/mcp#209 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di webdriverio/mcp
Issue simili
-
Postgres upgrade golden leaves fixture URL query parameters in the expected output comparisonAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
garrytan/gbrain#10437 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Bedrock "Too many tokens" throttle is not auto-retried, unlike "Too many requests"Forse già presa @acmerfight l’ha presa oggi. Apertauntriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
earendil-works/pi#12573 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
agentes-chat/agentes-chat#1506 ·
I maintainer di solito rispondono entro 1 giorno
-
comp/desktop desktop/files os/windows P2 type/perf
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
NousResearch/hermes-agent#160359 ·
I maintainer di solito rispondono entro 1 giorno
-
Missing repro Platform: Android
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
software-mansion/react-native-reanimated#11554 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno