diff options
author | eug-vs <eug-vs@keemail.me> | 2020-11-14 16:35:14 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-11-14 16:37:23 +0300 |
commit | 4f0561acef93970f69b0ddda1cea132532355e7d (patch) | |
tree | 4abff57990993be797538462f92935015ef46ae0 /src/handlers/attendConference.js | |
parent | 36465387454cdb797f886f732d40a70faa92cbad (diff) | |
download | bsu-fantom-4f0561acef93970f69b0ddda1cea132532355e7d.tar.gz |
refactor: create handlers folder
Diffstat (limited to 'src/handlers/attendConference.js')
-rw-r--r-- | src/handlers/attendConference.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/handlers/attendConference.js b/src/handlers/attendConference.js new file mode 100644 index 0000000..54d6479 --- /dev/null +++ b/src/handlers/attendConference.js @@ -0,0 +1,23 @@ +const { clickElementByXPath } = require('./utils.js'); + +const CONFERENCE_DURATION = 1000 * 60 * 80; // 80 minutes + + +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(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; |