Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

450
Views
PlayWright - TypeError: browser.newPage is not a function

When ever I am trying to run the code I am getting error "TypeError: browser.newPage is not a function". Here is my code

const {chromium} = require('playwright');
(async() => {
const browser = chromium.launch({
    headless:false
});
const page = await browser.newPage();
await page.goto('https://www.google.com');
await browser.close();
})();

If I change the code to the following then I am able to run the code but url is not getting open whatever I am providing, Just browser is getting open and close.

const playwright = require('playwright');
(async () => {
  for (const browserType of ['webkit']) {
    const browser = await playwright[browserType].launch({
        headless:false
    });
    const context = await browser.newContext();
    const page = await context.newPage('https://www.google.com');
    await browser.close();
  }
})();

I am using Playwright version 1.20.0 node.js version is v16.14.0

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try this

const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://www.google.com');

You might want to check out the documentation: https://playwright.dev/docs/1.19/intro#first-test

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!