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

216
Views
How to automatically dismiss a frame-embedded chat in Playwright?

I have been doing Playwright testing for some time on my company's site, and mostly it's gone all right. But we subscribe to Intercom, and it seems to pop up almost randomly, obscuring stuff I want to test. I've tried several ways, and this one seems to work:

this.page.on('frameattached', async (frame) => {
  await new Promise((resolve) => setTimeout(resolve, 500));
  try {
    const dismiss = await frame.waitForSelector('div[aria-label="Dismiss"]');
    if (dismiss) {
      dismiss.click({ timeout: 2000 });
    }
  } catch (_) {
    return Promise.resolve();
  }
  return Promise.resolve();
});

It's pretty clunky, though. I dislike using locators when it seems like ElementHandle would be the way to go, but I cannot figure out the syntax for it. It's easy enough to get the ElementHandle with frame.$(), but then I can't just do a .click() on the result.

Any clues on how to do this without the tedious timeout and try-catch?

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!