{"record":{"id":"74510a72ce5f8db1","repo":"projectdiscovery/nuclei","slug":"no-such-element","errorCode":null,"errorMessage":"no such element","messagePattern":"no such element","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/protocols/headless/engine/page_actions.go","lineNumber":986,"sourceCode":"\t\tjs, err := p.getActionArg(action, \"js\")\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\telement, err := page.ElementByJS(&rod.EvalOptions{JS: js})\n\t\treturn element, nil, err\n\tcase \"search\":\n\t\tquery, err := p.getActionArg(action, \"query\")\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\telms, err := page.Search(query)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tif elms.First != nil {\n\t\t\treturn elms.First, nil, nil\n\t\t}\n\t\treturn nil, nil, errors.New(\"no such element\")\n\tdefault:\n\t\tselector, err := p.getActionArg(action, \"selector\")\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\telement, err := page.Element(selector)\n\t\treturn element, &selector, err\n\t}\n}\n\n// DebugAction enables debug action on a page.\nfunc (p *Page) DebugAction(act *Action, out ActionData) error {\n\tp.instance.browser.engine.SlowMotion(5 * time.Second)\n\tp.instance.browser.engine.Trace(true)\n\treturn nil\n}\n\n// SleepAction sleeps on the page for a specified duration","sourceCodeStart":968,"sourceCodeEnd":1004,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/protocols/headless/engine/page_actions.go#L968-L1004","documentation":"pageElementBy resolves elements by different `by` modes; for `by: search` it calls page.Search (CDP DOM search) and if elms.First is nil — the query matched zero nodes — it returns this explicit 'no such element' error instead of rod's ErrElementNotFound.","triggerScenarios":"An action (click/extract/waitfor etc.) using `by: search` with a search query that matches nothing on the current page state, e.g. searching for button text that only renders after login or after async load.","commonSituations":"Searching for text that appears late (no preceding waitload/waitfor); search strings with typos; content inside iframes that a plain search does not reach.","solutions":["Confirm the search text/selector matches in DevTools on the rendered page","Add waitfor/waitidle before the search so async content is present","Prefer `by: selector` with a CSS selector when the element has a stable attribute","Increase page-timeout if the app renders slowly"],"exampleFix":"# before\n- action: click\n  by: search\n  q: Submit response\n\n# after\n- action: waitidle\n- action: click\n  by: search\n  q: Submit response","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, _, err := p.pageElementBy(page, act); err != nil {\n    if strings.Contains(err.Error(), \"no such element\") {\n        // treat as 'page state does not match' — record and move on\n        return nil\n    }\n    return err\n}","preventionTips":["Verify search strings/queries against the rendered page before templating","Insert waitfor/waitidle before search-based element resolution","Prefer stable CSS selectors over free-text search when possible"],"tags":["headless","dom","selector","search"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}