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

130
Vistas
Javascript Function - Return Response

I am new to javascript and trying to run a javascript function and return a response for this website below. I am trying to use 'document.querySelectorAll' to return a response for all the job titles and the URL for each job posting. How do I return a response for these elements?

Website: https://mckesson.wd3.myworkdayjobs.com/External_Careers

Here is my latest attempt:

function ExecuteScript() {
 let nameList = [];
 let response = '';

 document.querySelectorAll('a[data-automation-id="jobTitle"]').forEach((element, i) => {
  nameList.push(element.innerHTML);

 document.querySelectorAll('a[data-automation-id="jobTitle"]').forEach((element, i) => {
  response += nameList[i] + '\\t' + element.getAttribute('hef') + '\\n';
 });

 return response;
}

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

0

There are several problems with the example code:

  1. Syntax error: Two querySelectorAll are not nested correctly.

  2. Misspellings: hef should be href, and it's not enough to store only relative addresses; you need to add domain names in front of them.

  3. Because both capture elements of the same class, the two loops can be merged.

Can refer to the following code:

function ExecuteScript() {
  let response = '';
  document.querySelectorAll('a[data-automation-id="jobTitle"]').forEach((element, i) => {
    response += element.innerHTML + '\\t' + location.host + element.getAttribute('href') + '\\n';
  });
  return response;
}
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