I need to implement a function called waitForElementText()
in playwright.
For example, I have headers labeled with the CSS selector '.header-name'
on each page.
When navigating from the Home page to the Users page,
I provide two parameters to the method:
waitForElementText(locator: string, expectedText: string)
The goal is to wait for the header name to change from "Home" to "Users".
Although I attempted using the page.waitForFunction()
method, I encountered this error:
page.waitForFunction: TypeError: Cannot read properties of undefined (reading 'locator')