操作或读取页面元素
wdt_elementTarget and act on the nth element matching a CSS selector in WeChat DevTools: tap, input, inspect attributes/styles/data, scroll or swipe, trigger events, and call component methods.
Instructions
对匹配 selector 的第 index 个元素执行动作:tap/longpress/input/text/value/attribute/property/style/wxml/outerWxml/size/offset/trigger/scrollTo/scrollWidth/scrollHeight/swipeTo/slideTo/callMethod/callContextMethod/setData/data。slideTo 会补发 change 事件;swipeTo 只改视觉索引。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>",
"action": "<action>"
},
"name": "wdt_element"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | scrollTo 的 x | |
| y | No | scrollTo 的 y | |
| args | No | callMethod 的参数 | |
| data | No | setData 的数据 | |
| name | No | attribute/property/style/data 的名称 | |
| path | No | data 的路径 | |
| type | No | trigger 的事件名 | |
| index | No | 匹配项下标,默认 0 | |
| value | No | input/slideTo/swipeTo/data 的值 | |
| action | Yes | ||
| detail | No | trigger 的 detail | |
| method | No | callMethod 的方法名 | |
| selector | Yes |