2021年1月25日星期一

Download not working on Stealth Plugin with used with Puppeteer-extra

appreciate some assistance on the following issue, which seems to be from Stealth Plugin. I am using puppeteer to click on a download button in an iframe, which works when I am using Puppeteer, but not when I am using Stealth Plugin.

The problem: Once the button is clicked, nothing happens, no download is initiated.

Libraries Work/Doesn't work
Puppeteer Works
Puppeteer-extra Works
Puppeteer-extra + Stealth Plugin Doesn't work

Following is a simplified code which I am using:

const puppeteer = require("puppeteer-extra");  const StealthPlugin = require("puppeteer-extra-plugin-stealth");  puppeteer.use(StealthPlugin());  (async () => {     //Setup the browser    const browser = await puppeteer.launch({      headless: false,      ignoreHTTPSErrors: true,      args: ["--ignore-certificate-errors"],    });    const page = await browser.newPage();    await page._client.send("Page.setDownloadBehavior", {      //Initial setup for download      behavior: "allow",      downloadPath: downloadPath,    });    await page.setViewport({ width: 1366, height: 768 });        await page.goto("***websitehere***");    await page.waitForTimeout(3000);    const frameElement = await page.$("#iframe-analytics");    const frame = await frameElement.contentFrame();    await frame.waitForSelector(".table-download-button");    await frame.click(".table-download-button");    await browser.close();  })();     

Button which I'm trying to click on:

<button class="table-download-button md-icon-button md-button ng-scope md-scionTheme-theme md-ink-ripple" type="button" ng-transclude="" ng-if="ctrl.csvFormatter" ng-click="ctrl.downloadCsv()" aria-label="Download CSV" md-labeled-by-tooltip="md-tooltip-19">  <md-icon md-font-set="material-icons-extended" class="material-icons-extended ng-scope md-scionTheme-theme" aria-hidden="true" role="img">save_alt</md-icon>  <div class="md-ripple-container"></div></button>  

Would appreciate if someone could point out what other setting I have to change that's unique on puppeteer extra + stealth plugin.

https://stackoverflow.com/questions/65887186/download-not-working-on-stealth-plugin-with-used-with-puppeteer-extra January 25, 2021 at 10:57PM

没有评论:

发表评论