I'm trying to join the zoom meeting with puppeteer, but my code is unable to capture the type password element, can anyone please help?
This is my code
const puppeteer = require("puppeteer-extra");
const StealthPlugin = require("puppeteer-extra-plugin-stealth");
puppeteer.use(StealthPlugin());
async function joinZoomMeeting(){
let meetId = '773 2982 7579';
let meetPassCode = 'cnm4Ac';
let joineeName = 'Sj';
const browser = await puppeteer.launch({
headless: false,
args: [
"--disable-notifications",
"--enable-automation",
"--start-maximized",
],
ignoreDefaultArgs: false,
});
const [page] = await browser.pages();
await page.goto('https://app.zoom.us/wc/join')
await page.waitForSelector('input[type="text"]');
await page.type('input[type="text"]', meetId);
// await page.waitForSelector('.btn-join btn btn-primary')
const joinButton = await page.$('.btn-join')
await joinButton.click()
await page.waitForTimeout(5000);
const passwordField = await page.$('#input-for-pwd');
console.log(passwordField)
// await page.type('input[type="password"]', meetPassCode);
// await page.waitForSelector('input[type="text"]');
// await page.tpe('input[type="text"]' , joineeName);
// const passInput = await page.$('.preview-meeting-info-field-input')
// console.log(passInput)
// const passwordInputSelector = '#input-for-pwd';
// // Type the password into the input field
// await page.type(passwordInputSelector, meetPassCode);
}
joinZoomMeeting()
I've tried all the commented ways of capturing the element! But nothing worked!!
This is the element
<input id="input-for-pwd" type="password" class="preview-meeting-info-field-input" autocomplete="off" required="" aria-invalid="false" aria-describedby="error-for-pwd" value="">
Please let me know, how to fix this, I'm stuck at this point, the code is capturing the first type meeting Id element in the first page, but in the second page it is unable to capture the type password feild.
The main issue here is that the page has an iframe with most of the app in it. You'll need to select the iframe first, then make queries inside of it.
As with many websites, there are quirks, so I had to use
waitForFunction
that dives into the iframe to verify the presence of an element because the normalwaitForSelector
was timing out.You can take more actions or block the script with a timeout or remove
browser.close()
if you want the window to stay open indefinitely.Tips:
waitForTimeout
. It's both slow and flakey.waitForSelector
returns its element (disclosure: I am the author of the blog post), so better to use it than query it again withpage.$
, which isn't generally necessary.