1

How to get into the application which use windows authentication,

Hi All am new to puppeteer trying to do some automation and performance testing with puppeteer, so while trying to get into to application and do a sample check am not able to proceed because windows authentication not able to get through please help, i tried below code not working :(

const puppeteer = require('puppeteer');



async function test() {

    const proxyUrl = 'URL';
    const username = 'Uname';
    const password = 'pwd';

    const browser = await puppeteer.launch({
        args: [`--proxy-server=${proxyUrl}`],
        headless: false,
    });

    // let browser = await puppeteer.launch({ headless: false });
    let page = await browser.newPage();

    await page.authenticate({ username, password });
    await page.goto('URL')

    const html = await page.$eval('.ds-tile-container', e => e.innerHTML)
    expect(html).not.toBeNull();
    await page.pdf({ path: 'hn.pdf', format: 'A4' });

    browser.close()
}

test();

I tried below code also

const oldProxyUrl = 'https://siteurl:8080';
    const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);

    console.log(newProxyUrl);

    const args = [
        '--disable-setuid-sandbox',
        '--no-sandbox',
        '--ignore-certificate-errors',
        '--ignore-certificate-errors-spki-list ',
      ];
      const options = {
        args,
        headless: true,
        ignoreHTTPSErrors: true,
      };

    const browser = await puppeteer.launch(options);

now am getting error like

(node:20520) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Invalid "proxyUrl" option: only HTTP proxies are currently supported. (node:20520) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Aji
  • 423
  • 8
  • 23

0 Answers0