javascriptpuppeteergoogle-meet

Puppeteer isn't clicking a button despite it being on the page


Bug expectation

I expected the 'Join Now' button to be clicked on the Google Meet page after the 'Dismiss' button has been clicked.

Any help would be greatly appreciated.

Here is the dom node I am trying to click:

<button
  class="VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-k8QpJ VfPpkd-LgbsSe-OWXEXe-dgl2Hf nCP5yc AjY5Oe DuMIQc LQeN7 jEvJdc QJgqC"
  jscontroller="soHxf"
  jsaction="click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc; touchcancel:JMtRjd; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;mlnRJb:fLiPzd;"
  data-idom-class="nCP5yc AjY5Oe DuMIQc LQeN7 jEvJdc QJgqC"
  jsname="Qx7uuf"
>
  <div class="VfPpkd-Jh9lGc"></div>
  <div class="VfPpkd-J1Ukfc-LhBDec"></div>
  <div class="VfPpkd-RLmnJb"></div>
  <span jsname="V67aGc" class="VfPpkd-vQzf8d">Join now</span>
</button>

The puppeteer code is in the example section.

I have also tried grabbing the node by text, using text/Join Now however I receive the following error:

Error: Query set to use "text", but no query handler of that name was found
    at Object.getQueryHandlerAndSelector

Bug behavior

Minimal, reproducible example

const joinMeeting = async (page) => {
    console.log(logYellow, '📺 Joining meeting...');
    await page.goto('https://meet.google.com/');
    await page.waitForSelector('.mobgod', { visible: true });
    await page.click('.mobgod');
    await page.waitForSelector('.VfPpkd-vQzf8d');
    await page.click('.VfPpkd-vQzf8d'); // Click dismiss buttong
    await page.waitForSelector('.VfPpkd-LgbsSe');
    await page.click('.VfPpkd-LgbsSe'); // Click join button
    console.log(logGreen, '✅ Joined meeting!');
}

Error string

No error. Just hangs at the section where I need it to click the button.

Puppeteer configuration

No response

Puppeteer version

10.4.0

Node version

18.16.0

Package manager

pnpm

Package manager version

8.6.1

Operating system

macOS


Solution

  • All I needed to do was select all the buttons on the page, and then select the button using it's index.