029dbf57bd
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
20 lines
739 B
Go
20 lines
739 B
Go
package browser
|
|
|
|
import "fmt"
|
|
|
|
// CdpHoverRef mueve el ratón con trayectoria humanizada (Bézier) sobre el
|
|
// elemento del #ref. Útil para activar menús y tooltips que reaccionan a hover.
|
|
// El #ref es un backendDOMNodeId extraído del AX outline por page_perceive.
|
|
func CdpHoverRef(c *CDPConn, backendNodeID int, opts MouseHumanOpts) error {
|
|
if c == nil {
|
|
return fmt.Errorf("cdp hover ref: conexión nil")
|
|
}
|
|
// scroll al elemento si no está visible; ignorar error (no fatal)
|
|
_, _ = c.sendCDP("DOM.scrollIntoViewIfNeeded", map[string]any{"backendNodeId": backendNodeID})
|
|
cx, cy, err := refBoxCenter(c, backendNodeID)
|
|
if err != nil {
|
|
return fmt.Errorf("cdp hover ref: %w", err)
|
|
}
|
|
return CdpMoveMouseHuman(c, cx, cy, opts)
|
|
}
|