Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

451
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda