mcp iframe updates
This commit is contained in:
@@ -112,17 +112,21 @@ Switch iframe context for subsequent operations.
|
||||
- `action` (required): One of "enter", "exit"
|
||||
- `selector` (optional): Iframe CSS selector (required for "enter" action)
|
||||
- `tab` (optional): Specific tab ID to use
|
||||
- `timeout` (optional): Timeout in seconds (default: 5)
|
||||
|
||||
**Example Usage:**
|
||||
```
|
||||
web_iframe_cremotemcp:
|
||||
action: "enter"
|
||||
selector: "iframe#payment-form"
|
||||
timeout: 10
|
||||
|
||||
web_iframe_cremotemcp:
|
||||
action: "exit"
|
||||
```
|
||||
|
||||
**Note:** The timeout parameter is particularly important for iframe operations as they can hang if the iframe takes time to load or if the selector doesn't match any elements.
|
||||
|
||||
### 7. `file_upload_cremotemcp`
|
||||
Upload files from the client to the container for use in form uploads.
|
||||
|
||||
|
@@ -750,7 +750,7 @@ func (s *MCPServer) handleIframe(params map[string]interface{}) (ToolResult, err
|
||||
if selector == "" {
|
||||
return ToolResult{}, fmt.Errorf("selector parameter is required for enter action")
|
||||
}
|
||||
err = s.client.SwitchToIframe(tab, selector)
|
||||
err = s.client.SwitchToIframe(tab, selector, 5) // Default 5 second timeout
|
||||
s.iframeMode = true
|
||||
data = map[string]string{"action": "entered", "selector": selector}
|
||||
|
||||
|
@@ -636,7 +636,7 @@ func (s *MCPServer) handleIframe(params map[string]interface{}) (ToolResult, err
|
||||
if selector == "" {
|
||||
return ToolResult{}, fmt.Errorf("selector parameter is required for enter action")
|
||||
}
|
||||
err = s.client.SwitchToIframe(tab, selector)
|
||||
err = s.client.SwitchToIframe(tab, selector, 5) // Default 5 second timeout
|
||||
s.iframeMode = true
|
||||
data = map[string]string{"action": "entered", "selector": selector}
|
||||
|
||||
|
BIN
mcp/cremote-mcp
BIN
mcp/cremote-mcp
Binary file not shown.
BIN
mcp/cremote-mcp2
BIN
mcp/cremote-mcp2
Binary file not shown.
@@ -538,6 +538,11 @@ func main() {
|
||||
"type": "string",
|
||||
"description": "Tab ID (optional)",
|
||||
},
|
||||
"timeout": map[string]any{
|
||||
"type": "integer",
|
||||
"description": "Timeout in seconds",
|
||||
"default": 5,
|
||||
},
|
||||
},
|
||||
Required: []string{"action"},
|
||||
},
|
||||
@@ -551,6 +556,7 @@ func main() {
|
||||
action := getStringParam(params, "action", "")
|
||||
selector := getStringParam(params, "selector", "")
|
||||
tab := getStringParam(params, "tab", cremoteServer.currentTab)
|
||||
timeout := getIntParam(params, "timeout", 5)
|
||||
|
||||
if action == "" {
|
||||
return nil, fmt.Errorf("action parameter is required")
|
||||
@@ -567,7 +573,7 @@ func main() {
|
||||
if selector == "" {
|
||||
return nil, fmt.Errorf("selector parameter is required for enter action")
|
||||
}
|
||||
err = cremoteServer.client.SwitchToIframe(tab, selector)
|
||||
err = cremoteServer.client.SwitchToIframe(tab, selector, timeout)
|
||||
cremoteServer.iframeMode = true
|
||||
message = fmt.Sprintf("Entered iframe: %s", selector)
|
||||
|
||||
|
Reference in New Issue
Block a user