summaryrefslogtreecommitdiff
path: root/src/attendConference.js
blob: b7f744f2d918459e78fb14e8a37f35c839a600ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const clickElementByXPath = (page, xPath) => page
  .waitForXPath(xPath)
  .then(item => item.click());

const attendConference = async page => {
    // Join as "Listen only"
    await clickElementByXPath(page, '//span[contains(text(),"Listen only")]');
    console.log('Joined the conference');

    // Wait 5 seconds
    await page.waitForTimeout(5000);
    console.log('Time to leave!')

    // Leave audio and close the tab
    await clickElementByXPath(page, '//button[contains(@aria-label,"Leave audio")]');
    await page.waitForTimeout(1500);
    await page.close();
    console.log('Left the conference');
};

module.exports = attendConference;