🌐 AI搜索 & 代理 主页
Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

TypeError: screen.findByTestId(...).click is not a function #510

@InduKrish

Description

@InduKrish

await screen.findByTestId('Edit Group Codes').click();;
TypeError: screen.findByTestId(...).click is not a function

await screen.findByTestId('Edit Group Codes').click();;

Since we now use the locator API, Can you please advise why click() function is still not resolved?

We expect playwright testing library to behave something like how playwright behaves. click() function after locator is found like below.
-----> await page.locator('input#password').click()

Code that worked - Only increases no of lines in the test and assigning to a variable before performing click() action does not let a user to interact like how playwright allows as above, so the code would be less maintainable and not user friendly.
const form = await screen.findByTestId('Edit Group Codes');
await form.click();

Do you have any plan to let findByTestId behave the same way like how playwright official library behaves to perform click action in a single line like this await page.locator('input#password').click() ?

Example: Cypress example using playwright testing library, We expected something like this.
cy.findByTestId('menu-option-dashboard-link').click().wait(1000);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions