← Back to Discord Forum

I am getting TypeError: Cannot read properties of undefined (reading 'getByRole')

my solution has page objects defined in a separate file, when i am running test for one particular test i get this error as shown in screenshot I have also attached the snippet where i am using the page object, please help me to figure out where it is wrong


This thread is trying to answer question "How to fix the TypeError related to 'getByRole' in the user's implementation of Page Object Model?"

2 replies

your pom implementation is wrong, check example in the docs:


constructor does not set values to any class members

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.