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

188
Views
Obtenga la página completa del dramaturgo en html y texto

Estoy usando dramaturgo en nodejs y tengo algunos problemas al obtener la página Texto o Html. Solo quiero obtener la URL como una cadena como: <html><div class="123"><a>link</a>something</div><div>somethingelse</div></hmtl>

 const browser = await playwright.chromium.launch({ headless: true, }); const page = await browser.newPage(); await page.goto(url);

Estaba tratando de usar const pageText = page.$('div').innerText; y también const pageText2 = await page.$$eval('div', el => el.innerText); Pero ambos no funcionan y solo me dan indefinido.

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

0

Para el html completo de la página, esto es lo que necesita: const html = await page.content()

Para obtener el texto interno del div, esto debería funcionar: const pageText = await page.innerText('div')

Ver:

  • https://playwright.dev/docs/api/class-page#page-content
  • https://playwright.dev/docs/api/class-page#page-inner-text
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!