Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

318
Vistas
Targeting auto-generated elements with node.js puppeteer

I am using puppeteer for node.js v13.3.1, I am building a bot that will apply to jobs on linkedIn. So far I have the following code.

const puppeteer = require('puppeteer');
   const SEARCHPARAM = "react" // change this for search param 
require("dotenv").config();
(async () => {
    const browser = await puppeteer.launch({headless:false});
  const page = await browser.newPage();
  await page.goto('https://www.linkedin.com/login?fromSignIn=true&trk=guest_homepage-basic_nav-header-signin')
  await page.setViewport({ width: 1920, height: 1080});
  await page.type("#username", process.env.NAMEUSERNAME)
  await page.type("#password", process.env.PASSWORD)
  await page.click('button[type="submit"]')
  //works fine
  await Promise.all([
    await page.waitForNavigation(), 
    await page.click('#global-nav > div > nav > ul > li:nth-child(3)'), 
    await page.type('input', SEARCHPARAM ), 
    await page.click('button[type="button"]'),
    await page.click('#ember1052 > span') //Will not hit the button
  ]);


})();

So far the bot is logging in and searching with the SEARCHPARAM just fine, however I am having trouble getting the bot to hit the easy apply button on the job posting. Whenever I target this button I get the id as ember(number) and this number is never the same on different browser windows. I have tried targeting the button by class but node is telling me that it cannot find that selector.
Puppeteer docs for reference docs

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Please see this link for more detailed answer:
How to click element in Puppeteer using xPath

const elements = await page.$x('<xPath>')
await elements[0].click() 

And your XPath selector should be like this:

const element = await page.$x('//button/span[text()="Easy Apply"]')

Code syntax for:
Button element that contain span element which has text inside "Easy Apply"

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda