--- name: cdp_find_by_text kind: function lang: go domain: browser version: 0.1.0 purity: impure signature: "func CdpFindByText(c *CDPConn, text string, opts FindByTextOpts) (string, error)" description: "Busca el primer elemento cuyo innerText matchea el texto dado y retorna un selector CSS unico. Prefiere elementos hoja (no contenedores). Util para pruebas robustas que no dependen de selectores CSS fragiles del DOM. Combinable con CdpClick para click-by-text." tags: [browser, cdp, find, locator, accessibility] uses_functions: - cdp_evaluate_go_browser uses_types: [] returns: [] returns_optional: false error_type: error_go_core imports: [] example: | c, _ := browser.CdpConnect(9222) defer browser.CdpClose(c, 0) sel, err := browser.CdpFindByText(c, "Submit", browser.FindByTextOpts{Tag: "button"}) if err == nil && sel != "" { browser.CdpClick(c, sel) } tested: true tests: ["TestCdpFindByText_buildsSelectorScript"] test_file_path: "functions/browser/cdp_find_by_text_test.go" file_path: "functions/browser/cdp_find_by_text.go" notes: | - Prefiere "leafmost": si un
contiene un