Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
How can I get the search button textusing PlayWright end to end testing tool

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);
     
    });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!