const { clickElementByXPath } = require('./utils.js'); const attendConference = async (page, onJoin) => { // Join as "Listen only" await clickElementByXPath(page, '//span[contains(text(),"Listen only")]'); if (typeof(onJoin) === 'function') onJoin(); 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;