brower.newPage() return a null
See original GitHub issueSteps 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:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@IWSR please, either use older pptr (e.g. 0.9.0) or newer chrome.
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: