chore: auto-commit (97 archivos)
- .claude/CLAUDE.md - .claude/agents/fn-recopilador/SKILL.md - .claude/rules/INDEX.md - .claude/rules/cpp_apps.md - bash/functions/infra/build_cpp_windows.sh - cpp/CMakeLists.txt - cpp/PATTERNS.md - cpp/framework/app_base.cpp - cpp/framework/app_base.h - dev/issues/README.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package browser
|
||||
|
||||
import "fmt"
|
||||
|
||||
// CdpClickText combina CdpFindByText + CdpClick: localiza el primer elemento
|
||||
// con `text` y le hace click. Util para tests/scraping sin depender de
|
||||
// selectores CSS fragiles.
|
||||
//
|
||||
// Si no encuentra ningun elemento con ese texto, retorna error claro
|
||||
// (no falso negativo silencioso).
|
||||
func CdpClickText(c *CDPConn, text string, opts FindByTextOpts) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("cdp click text: conexion nula")
|
||||
}
|
||||
sel, err := CdpFindByText(c, text, opts)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cdp click text: %w", err)
|
||||
}
|
||||
if sel == "" {
|
||||
return fmt.Errorf("cdp click text: no se encontro elemento con texto %q (tag=%q exact=%v)", text, opts.Tag, opts.Exact)
|
||||
}
|
||||
if err := CdpClick(c, sel); err != nil {
|
||||
return fmt.Errorf("cdp click text: click sobre %q: %w", sel, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user