How can I get the search button text in PlayWright end to end testing tool. I have tried below and getting page.innerText(selector, options) but getting undefined. Can someone please advise why the innerText method is not working here.
//homePage.js
const { expect } = require('@playwright/test');
exports.HomePage = class HomePage {
constructor(page) {
this.page = page;
this.getSearchButton = page.innerText(.RoundButton__root .RoundButton__root--blue');
}
async goto() {
await this.page.goto('https://www.localsearch.com.au/');
}
async getSearchButtonText() {
await this.getSearchButton ;
}
}
//home.js
const { test, expect } = require('@playwright/test');
const { HomePage } = require('../pom/homePage');
test('Verify Search button text', async ({ page }) => {
const homePage = new HomePage(page);
await homePage.goto();
const text = await homePage.getSearchButtonText();
console.log("Search text::"+text);
});