playwright_action
Automate web browser interactions by locating elements and performing actions like clicking, typing, or extracting data using Playwright selectors and commands.
Instructions
根据给定的locator 和action 执行操作
Input Schema
Name | Required | Description | Default |
---|---|---|---|
action | Yes | 操作类型,可选项: fill,click,dblclick,hover,tap,check,uncheck,select_option,press,type,focus,blur,drag_to,screenshot,get_text,count,is_visible,is_enabled,is_hidden,is_disabled,is_checked,get_attribute,evaluate,wait_for,press_sequentially,clear,scroll_into_view,set_input_files,select_text,dispatch_event,get_inner_text,get_inner_html,get_content,all_inner_texts,all_text_contents | |
attribute_name | No | 要获取的属性名称,用于get_attribute操作 | |
button | No | 鼠标按钮,用于点击操作,可选: 'left', 'right', 'middle' | |
by | Yes | 选择元素方式,遵循playwright的选择器原则,可选项: get_by_text,get_by_placeholder,get_by_label,get_by_role,get_by_alt_text,get_by_title,get_by_test_id,get_by_css,locator | |
by_value | Yes | 选择元素的值 | |
delay | No | 按键之间的延迟(毫秒) | |
event_data | No | 事件数据,JSON格式的字符串,用于dispatch_event操作 | |
event_name | No | 要分发的事件名称,用于dispatch_event操作 | |
exact | No | 是否精确匹配文本 | |
filename | No | 截图保存的文件名,用于screenshot操作 | |
files | No | 要上传的文件路径,用于set_input_files操作,多个文件用逗号分隔 | |
force | No | 是否强制执行动作,无视actionability检查 | |
has_text | No | 元素必须包含的文本 | |
modifiers | No | 修饰键,用于键盘操作,可选: 'Alt', 'Control', 'Meta', 'Shift' | |
no_wait_after | No | 是否不等待动作完成后的导航 | |
options | No | 选择框的选项,用于select_option操作,JSON格式的字符串,可以包含 value, label, index | |
position | No | 相对于元素的点击位置,格式为: 'x,y' | |
script | No | 要在元素上执行的JavaScript代码,用于evaluate操作 | |
selector | No | 拖拽目标元素的选择器,用于drag_to操作 | |
state | No | 等待的元素状态,用于wait_for操作,可选: 'attached', 'detached', 'visible', 'hidden' | |
strict | No | 是否严格匹配元素(如果找到多个元素是否报错) | |
timeout | No | 操作超时时间(毫秒) | |
value | No | 操作的值 |
Input Schema (JSON Schema)
{
"properties": {
"action": {
"description": "操作类型,可选项: fill,click,dblclick,hover,tap,check,uncheck,select_option,press,type,focus,blur,drag_to,screenshot,get_text,count,is_visible,is_enabled,is_hidden,is_disabled,is_checked,get_attribute,evaluate,wait_for,press_sequentially,clear,scroll_into_view,set_input_files,select_text,dispatch_event,get_inner_text,get_inner_html,get_content,all_inner_texts,all_text_contents",
"type": "string"
},
"attribute_name": {
"description": "要获取的属性名称,用于get_attribute操作",
"type": "string"
},
"button": {
"description": "鼠标按钮,用于点击操作,可选: 'left', 'right', 'middle'",
"type": "string"
},
"by": {
"description": "选择元素方式,遵循playwright的选择器原则,可选项: get_by_text,get_by_placeholder,get_by_label,get_by_role,get_by_alt_text,get_by_title,get_by_test_id,get_by_css,locator",
"type": "string"
},
"by_value": {
"description": "选择元素的值",
"type": "string"
},
"delay": {
"description": "按键之间的延迟(毫秒)",
"type": "number"
},
"event_data": {
"description": "事件数据,JSON格式的字符串,用于dispatch_event操作",
"type": "string"
},
"event_name": {
"description": "要分发的事件名称,用于dispatch_event操作",
"type": "string"
},
"exact": {
"description": "是否精确匹配文本",
"type": "boolean"
},
"filename": {
"description": "截图保存的文件名,用于screenshot操作",
"type": "string"
},
"files": {
"description": "要上传的文件路径,用于set_input_files操作,多个文件用逗号分隔",
"type": "string"
},
"force": {
"description": "是否强制执行动作,无视actionability检查",
"type": "boolean"
},
"has_text": {
"description": "元素必须包含的文本",
"type": "string"
},
"modifiers": {
"description": "修饰键,用于键盘操作,可选: 'Alt', 'Control', 'Meta', 'Shift'",
"type": "array"
},
"no_wait_after": {
"description": "是否不等待动作完成后的导航",
"type": "boolean"
},
"options": {
"description": "选择框的选项,用于select_option操作,JSON格式的字符串,可以包含 value, label, index",
"type": "string"
},
"position": {
"description": "相对于元素的点击位置,格式为: 'x,y'",
"type": "string"
},
"script": {
"description": "要在元素上执行的JavaScript代码,用于evaluate操作",
"type": "string"
},
"selector": {
"description": "拖拽目标元素的选择器,用于drag_to操作",
"type": "string"
},
"state": {
"description": "等待的元素状态,用于wait_for操作,可选: 'attached', 'detached', 'visible', 'hidden'",
"type": "string"
},
"strict": {
"description": "是否严格匹配元素(如果找到多个元素是否报错)",
"type": "boolean"
},
"timeout": {
"description": "操作超时时间(毫秒)",
"type": "number"
},
"value": {
"description": "操作的值",
"type": "string"
}
},
"required": [
"by",
"by_value",
"action"
],
"type": "object"
}