Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

166
Vistas
Puppeteer can´t find the absolute path of the page

Im trying to make a puppeteer web-scraping script with javascript, that allow me to get the email of many course sellers on that site and when I try to make it click on one, it return me an error of "Evaluation failed", im using this example :(https://www.tutorialspoint.com/puppeteer/puppeteer_absolute_xpath.htm), and i allready tried in my machine and it works, my guess is that im not giving the right path but in the example they tell you to just copy the absolute path of the element you want to click it and it should work. (sorry for my poor english, not my first language) Anyway Here is my code:

const puppeteer = require('puppeteer');

async function robo(){

  const browser = await puppeteer.launch({headless:false, defaultViewport: false});
  const page = await browser.newPage();

  await page.goto('https://app-vlc.hotmart.com/market/search?categoryId=25&page=1&userLanguage=PT_BR');

  await page.type('[data-test-id="login-email"]', 'my e-mail')
  await page.type('[data-test-id="login-password"]', 'my password')
 
  await page.click('[data-test-id="login-submit"]')
  
  await page.waitForTimeout(7000)
    await page.click("/html/body/div[2]/div[1]/div[2]/main/div[2]//div/div[2]/div[3]/div[1]")[0]

    await page.waitForTimeout(4000)
    //obtain URL after click
    console.log(await page.url())
 }
    
  //browser.close();



   //await browser.close();
  

  robo();```
7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos