mcp iframe updates

This commit is contained in:
Josh at WLTechBlog
2025-08-16 07:13:33 -05:00
parent cf34368901
commit e1f2c45c3a
11 changed files with 239 additions and 13 deletions

View File

@@ -527,7 +527,8 @@ func (c *Client) TakeScreenshot(tabID, outputPath string, fullPage bool, timeout
// SwitchToIframe switches the context to an iframe for subsequent commands
// If tabID is empty, the current tab will be used
func (c *Client) SwitchToIframe(tabID, selector string) error {
// timeout is in seconds, 0 means no timeout
func (c *Client) SwitchToIframe(tabID, selector string, timeout int) error {
params := map[string]string{
"selector": selector,
}
@@ -537,6 +538,11 @@ func (c *Client) SwitchToIframe(tabID, selector string) error {
params["tab"] = tabID
}
// Add timeout if specified
if timeout > 0 {
params["timeout"] = strconv.Itoa(timeout)
}
resp, err := c.SendCommand("switch-iframe", params)
if err != nil {
return err