Skip to content

[js] link text TypeScript locator matches links that are not rendered #18215

Closed

Description

@AutomatedTester

The TypeScript link-text locator reads a link's text with innerText. For an element that is not rendered (for example display:none), innerText falls back to the text content. So a hidden link can match an exact or partial link-text search, and the caller can get a different element back. The Closure locator used bot.dom.getVisibleText, which returns an empty string for hidden elements.

This was already on trunk in javascript/atoms/typescript/find-elements.ts (innerText ?? textContent). #18175 moved it unchanged into core/locators.ts (getLinkText). Qodo raised it there: #18175 (comment)

Suggested fix: when the link is not shown, treat its text as empty, keeping the   normalisation and the trim. Add exact and partial link-text tests against a display:none link.

Activity

  1. added 3 commits that reference this issue on Oct 22, 2026
    4e9e3e2
    534cb5b
    9e83e8c
  2. added a commit that references this issue on Oct 23, 2026
    5d90c7d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions