[BUG] UnhandledPromiseRejectionWarning: TypeError: browser.newPage is not a function
See original GitHub issueContext:
- Playwright Version: 0.10.0
- Operating System: Mac
- Node: 10.15.0
Code Snippet
const { chromium, firefox, webkit } = require('playwright');
(async () => {
const browser = await chromium.launch(); // Or 'firefox' or 'webkit'.
const page = await browser.newPage('http://example.com');
// other actions...
await browser.close();
})();
Describe the bug
~/Desktop/playwright 59s
❯ node test.js
(node:38001) UnhandledPromiseRejectionWarning: TypeError: browser.newPage is not a function
at /Users/artur/Desktop/playwright/test.js:5:30
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:38001) 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:38001) [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.
Thanks for the awesome project! Very excited about this. Stumbling into this issue after npm install playwright
and trying a simple test script from the readme examples.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
nodejs How to fix `browser.newPage is not a function` using ...
The problem in your code is that puppeteer works with Promises, meaning that most functions will return a Promise instead of the value ......
Read more >browser.newPage is not a function · Issue #1326 - GitHub
It is giving me this error: findEmail error: TypeError: browser.newPage is not a function. I'm using the latest version of puppeteer.
Read more >[TypeError] Puppeteer: `browser.newpage` is not a function
It seems to be runtime error, so it is definitely not a function in this case. Are you sure it is not undefined...
Read more >puppeteer.Browser.newPage JavaScript and Node.js code ...
Promise which resolves to a new Page object. Most used puppeteer functions. launch. The method launches a browser instance with given arguments. The...
Read more >TypeError: page.reload is not a function - CodeRanch
I found a fix. In your first monitor function, you didn't use await with page, so it is a promise, and promises don't...
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 Free
Top 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
@arturi I suppose this is because this https://github.com/microsoft/playwright/pull/840 Cause it isn’t released yet, you should use context:
We will be bringing back
browser.newPage
in 0.11, but for now please usenewContext
as suggested in the docs and above.