Scripting With Puppeteer

Hello -

Is it possible to use puppeteer to script logging into either a lock.js site or a hosted signup page? I’ve been working on this for a while and haven’t been able to accomplish to actually be able to have puppeteer successfully click correctly on a social signin button.

Thanks for any help!

It is possible.

Start with simple auth0 (non-social) account first.

Do something like:

    const browser = await puppeteer.launch({args: ['--disable-dev-shm-usage']});
    const page = await browser.newPage();
    
    await page.goto('${host}', { 'waitUntil': 'networkidle2' });
    await page.waitFor(300);

    await page.waitFor('input[name=email]');
    await page.waitFor(300);
    
    await page.type('input[name=email]', '${login}');
    await page.waitFor(300);
    
    await page.type('input[name=password]', '${password}');
    await page.waitFor(300);
   
    await page.keyboard.press('Enter');
    await page.waitFor(1500);
    await page.waitForSelector('img');
     
    const cookies = await page.cookies();

Where host is the base / landing url, prior to redirect, and has at least one “img” tag. If no “img” tag, change waitForSelector appropriately. Cookies should contain your connect.sid which you can then send as Cookie header for access to backend. If cookies contains auth0, then play with timeouts. Also - for debugging, take screenshots in between… it can be helpful to see what page looks like at each step.

Thanks a lot for sharing that knowledge!