Skip to content

Commit

Permalink
More changes to test puppeteer 10.0.0 vs 10.1.0 specifically
Browse files Browse the repository at this point in the history
Also replicates the bug at puppeteer/puppeteer#7757 and rules out a Chrome version change as the problem (the version of Chrome didn't change between 10.0.0 and 10.1.0)
  • Loading branch information
MartinFalatic committed Dec 21, 2021
1 parent 6392e0d commit 2d968da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Expand Up @@ -29,6 +29,9 @@ RUN apt update \
libgbm1 \
libasound2 \
libatspi2.0-0 \
# Needed by older Chromium only
libx11-xcb1 \
libxshmfence1 \
&& \
apt purge --auto-remove -y

Expand Down
15 changes: 12 additions & 3 deletions app/app.js
Expand Up @@ -35,8 +35,10 @@ async function main() {

if (true) {
const browser = await puppeteer.launch({
dumpio: true, // You may see dbus errors
headless: true,
executablePath: "./node_modules/puppeteer/.local-chromium/linux-938248/chrome-linux/chrome",
executablePath: "./node_modules/puppeteer/.local-chromium/linux-938248/chrome-linux/chrome", // puppeteer@~13.0.0
//executablePath: "./node_modules/puppeteer/.local-chromium/linux-884014/chrome-linux/chrome", // puppeteer@~10.0.0, ~10.1.0
args: [
'--disable-gpu',
'--disable-dev-shm-usage',
Expand All @@ -57,22 +59,29 @@ async function main() {
await page.goto('https://www.example.com', {
waitUntil: 'networkidle2',
});
call = await page.screenshot({path: '/myapp/output/screenshot.png'});
call = await page.screenshot({path: '/myapp/output/screenshot.png', format: 'a4', fullPage: true });
await page.close();

// Save a page as PDF
page = await browser.newPage();
await page.goto('https://news.ycombinator.com', {
waitUntil: 'networkidle2',
});
call = await page.pdf({ path: '/myapp/output/screenshot.pdf', format: 'a4' });
call = await page.pdf({ path: '/myapp/output/screenshot.pdf', format: 'legal' });
await page.close();

// Save a page as PDF
page = await browser.newPage();
await page.goto('file:///myapp/content/index.html', {
waitUntil: 'networkidle2',
});

// page.on("pageerror", function(err) {
// theTempValue = err.toString();
// console.log("Page error: " + theTempValue);
// });

call = await page.screenshot({ path: '/myapp/output/screenshot2.png', format: 'a4', fullPage: true });
call = await page.pdf({ path: '/myapp/output/screenshot2.pdf', format: 'Legal' });
await page.close();

Expand Down

0 comments on commit 2d968da

Please sign in to comment.