blob: 8f5c53ff8a66e24f14fa89c3ed232b615dd100ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const { clickElementByXPath } = require('./utils.js');
const CONFERENCE_DURATION = process.env.NODE_ENV === 'production'
? 1000 * 60 * 80 // 80 minutes
: 5000;
const attendConference = async (page, onJoin) => {
// Join as "Listen only"
await clickElementByXPath(page, '//span[contains(text(),"Listen only")]');
if (typeof(onJoin) === 'function') onJoin();
// Wait 5 seconds
await page.waitForTimeout(CONFERENCE_DURATION);
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;
|