Rayrun
← Back to Discord Forum

testIdAttribute override question

ricsimps_83874posted in #help-playwright
Open in Discord
ricsimps_83874

I'm working with a sign in component that doesn't use testID, instead it uses an attribute called data-id. I'm trying to redefine testIDAttribute to be data-id. I've read the docs and it seems pretty strightforward. I edited the 'use' block in playwright.config.js, adding < testIdAttribute: 'data-id' >. (I've assume I make the edit in the playwright.config.js file for the project where the tests reside, not in the initial install's config.) It doesn't work. Is there some ordering needed in the 'use' block?

This thread is trying to answer question "How to redefine testIDAttribute to be data-id in a sign in component?"

3 replies
refactoreric

Hi @skorp32 actually the link you are referring to is for Playwright library, but @playwright/test has support for this through configuration as well: https://playwright.dev/docs/api/class-testoptions#test-options-test-id-attribute

Hi @ricsimps_83874, could you show more of the playwright.config.js ?

And what do you mean "not in the initial install's config" ? Do you still have the sample config file floating around somewhere else?

oh right, my bad then

Related Discord Threads

TwitterGitHubLinkedIn
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.