5b10b419a2
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
24 lines
622 B
Go
24 lines
622 B
Go
package browser
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// CdpGetFrameHTML retorna el HTML completo (outerHTML del documentElement) de un iframe
|
|
// especifico usando CdpEvalInFrame con la expresion "document.documentElement.outerHTML".
|
|
func CdpGetFrameHTML(c *CDPConn, frameID string) (string, error) {
|
|
if c == nil {
|
|
return "", fmt.Errorf("cdp get frame html: conexion nula")
|
|
}
|
|
if frameID == "" {
|
|
return "", fmt.Errorf("cdp get frame html: frameID vacio")
|
|
}
|
|
|
|
html, err := CdpEvalInFrame(c, frameID, "document.documentElement.outerHTML")
|
|
if err != nil {
|
|
return "", fmt.Errorf("cdp get frame html: %w", err)
|
|
}
|
|
|
|
return html, nil
|
|
}
|