← Back to Discord Forum

getByTestId chaining


I have the following selector:

[data-testId="folder-card:${folderUuid}"] [data-testId="card-actions"]

So essentially I need a way to chain calls to page.getByTestId() - is there a way to achieve this?

This thread is trying to answer question "Is it possible to chain calls to page.getByTestId() using a specific selector?"

3 replies

not with getByTestId method

I assume card-actions is not a child of the first data test id?

Actually I was able to chain them, the docs say this : "Note that all methods that create a locator, such as page.getByLabel(), are also available on the Locator and FrameLocator classes, so you can chain them and iteratively narrow down your locator." So I probably had some typo in the selector and this is why the chaining didn't work initially

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.