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

171
Vistas
WebDriverIO (JavaScript) - Object key-value pair is not iterating as expected

I have an array of objects 'arr'. each value should be looped through forEach loop and key (which is a parentEle) should be clicked first and the value (which is a childEle) should be clicked next. like wise the loop should repeat 5 times. where as it is looping all the five elements at a time and then clicking on the first parentEle1 and then exiting the loop. Tried lot of ways but no luck. highly appreciate any resolution on this.

static changeCoverage = async function (testData) {
var onlyCoverage = _.drop(testData[0].coverage);
onlyCoverage.forEach(async (coverages) => {
  var filteredCoverage = _.omit(coverages, ["coverageType"]);
  Object.entries(filteredCoverage).forEach(async ([key, value]) => {
    var isKeyDisplayed = await $(`//div[text()="${key}"]`).isDisplayed()
    logger.info(
      "INFO",
      "availability of coverage key we are changing is: " + isKeyDisplayed
    );
    await coveragesPM.clickAndWait($(`//div[text()="${key}"]`))

    var isValueDisplayed = await $(`//div[text()="${key}"]/../../../../../..//span[text()="${value}"]`).isDisplayed()
    logger.info(
      "INFO",
      "availability of coverage value we are changing is: " + isValueDisplayed
    );
    await coveragesPM.clickAndWait($(`//div[text()="${key}"]/../../../../../..//span[text()="${value}"]`))
  });
});

}

about 4 years ago · Santiago Gelvez
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