question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

brower.newPage() return a null

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: ^0.13.0
  • Platform / OS version: Debian
  • Node.js version: v9.3.0
  • Chrome version: 62.0.3202.62

What steps will reproduce the problem?

I just run the code by node app.js,and there is my code in app.js

const puppeteer = require('puppeteer');

(async () => {
  const brower = await puppeteer.launch({
    headless: false,
    executablePath: '/opt/google/chrome/chrome',
  });
  const page = await brower.newPage();
  console.log(page, 'page'); // page is null
  await page.goto('https://github.com');
  const dimensions = await page.evaluate(() => {
    return {
      width: document.documentElement.clientWidth,
      height: document.documentElement.clientHeight,
      deviceScaleFactor: window.devicePixelRatio
    }
  });

  console.log('Dimensions:', dimensions);

  await brower.close();
})()

What is the expected result? My code is exactly the same as the demo code.It should have run the code successfully,but there is something wrong,the page is null.

What happens instead?

[AsyncFunction: newPage]
null 'page'
(node:15517) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'goto' of null
    at __dirname (/home/iwsr/myCode/nodejs/Spider_Intermediaries_Killer/app.js:11:14)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
(node:15517) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15517) [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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
aslushnikovcommented, Jan 8, 2018

@IWSR please, either use older pptr (e.g. 0.9.0) or newer chrome.

2reactions
ebidelcommented, Jan 8, 2018

That version of chrome is much older than the one puppeteer requires in 0.13.0. That version bundles m64.

On Mon, Jan 8, 2018, 7:59 AM Asuka notifications@github.com wrote:

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: ^0.13.0
  • Platform / OS version: Debian
  • Node.js version: v9.3.0
  • Chrome version: 62.0.3202.62

What steps will reproduce the problem?

I just run the code by node app.js,and there is my code in app.js

const puppeteer = require(‘puppeteer’);

(async () => { const brower = await puppeteer.launch({ headless: false, executablePath: ‘/opt/google/chrome/chrome’, }); const page = await brower.newPage(); console.log(page, ‘page’); // page is null await page.goto(‘https://github.com’); const dimensions = await page.evaluate(() => { return { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight, deviceScaleFactor: window.devicePixelRatio } });

console.log(‘Dimensions:’, dimensions);

await brower.close(); })()

What is the expected result? My code is exactly the same as the demo code.It should have run the code successfully,but there is something wrong,the page is null.

What happens instead?

[AsyncFunction: newPage] null ‘page’ (node:15517) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘goto’ of null at __dirname (/home/iwsr/myCode/nodejs/Spider_Intermediaries_Killer/app.js:11:14) at <anonymous> at process._tickCallback (internal/process/next_tick.js:160:7) (node:15517) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:15517) [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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GoogleChrome/puppeteer/issues/1745, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOigPCIB2BdGvdhXNHgfcNwSz4zJiunks5tIjtGgaJpZM4RWkr5 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browser.newPage() returns null when launch ...
newPage() returning a null. Let's try to find out what's causing this? In my case: Running with default executablePath runs Ok in both...
Read more >
page.evaluate returning null values but browser console ...
Page.evaluate function is returning null values. But the same function in the browser console returns the right values.
Read more >
Page class - Puppeteer
If no element matches the selector, the return value resolves to null . ... browserContext(), Get the browser context that the page belongs...
Read more >
BrowserContext | Playwright
Playwright allows creation of "incognito" browser contexts with browser.newContext() ... If it was launched as a persistent context null gets returned.
Read more >
Window.open() - Web APIs - MDN Web Docs
If this feature is set, the browser will omit the Referer header, ... When window.open() returns, the window always contains about:blank .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found