Cannot read properties of undefined (reading 'goto')

Cannot read properties of undefined (reading 'goto')
I encountered below error when trying to run my code. Cannot read properties of undefined (reading 'goto') exports.LoginPage= class LoginPage{ contructor(page){ this.page=page; this.usernameInput='#user-name'; this.passwordInput='#password'; this.loginButton='#login-button'; } async goToLoginPage(){ //console.log("test"); await this.page.goto('https://www.saucedemo.com/'); } async attemptLogin(username, password){ await this.page.locator(this.usernameInput).fill(username); await this.page.locator(this.passwordInput).fill(password); await this.page.locator(this.loginButton).click(); } } import { test, expect} from '@playwright/test'; import { LoginPage } from '../pages/LoginPage'; test('TC0001', async({page}) =>{ const login = new LoginPage(page); await login.goToLoginPage(); await login.attemptLogin('standard_use','secret_sauce'); await page.waitForTimeout(3000); });

Take Your Experience to the Next Level

New

Download our mobile app for a faster and better experience.

Comments

0
U

Join the discussion

Sign in to leave a comment

0:000:00