← Back to Discord Forum

having issue with new object in POM

4 | test('login', async ({page}) =>{ 5 | let loginpage : LoginPageAuth

6 | loginpage = new LoginPageAuth(page) | ^ 7 | 8 | await loginpage.goto() 9 |

This thread is trying to answer question "Why is the user encountering an error 'loginpage not a constructor' when trying to create a new instance of 'LoginPageAuth'?"

6 replies

? and what's the issue?

loginpage not a constructor

how does your login page pom look like?

normal pom

import {expect, Locator, Page} from '@playwright/test';

export class LoginPageAuth{ readonly page: Page;

constructor(page: Page) { this.page = page;


async goto() { await this.page.goto('h') } }

maybe you're not importing it in test file?

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.