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

202
Views
Playwright waitFor changed innerText to be exact value

I have an innerText that changed after 2-3 sec from Loading to Play . I would like to wait for the innerText to change to Play. I'm using the following code :

let attempt = 0;
let maxRetries = 4;

let payerButtonStatus = await this.player_page.innerText('#playingStatus');
while (attempt < maxRetries) {
    if (payerButtonStatus !== 'Loading') {
        console.log(`payerButtonStatus = ${payerButtonStatus}`);
        return true;
    }
    console.log(`Playback button status is - ${payerButtonStatus}, wait for 1sec and continue... ${attempt}/${maxRetries}`);
    await this.player_page.waitForTimeout(1000);
    payerButtonStatus = await this.player_page.innerText('#playingStatus');
    console.log(`payerButtonStatus= ${payerButtonStatus}`);
    attempt++;
}
return false;

Is there a better code to write this ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use a text selector on a waitForSelector. It will wait for 30 seconds by default:

await this.player_page.waitForSelector('text=Play');
about 4 years ago · Juan Pablo Isaza Report
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!