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

165
Vistas
Get text of multiple elements in Nightwatch.js and compare it with a list of strings

I'm a beginner in software automation testing. First I learned Selenium with python, so I know there's a possibility to get the inner text of multiple elements, which is given back in a list. Now I'm working with nightwatch.js and I want to get the text of all headings in the top line of my website - maybe store them in list - and compare these strings with expected strings in a prepared list. I've just reached the point where I get the text of the headings. I wanted to store them in a list (with list.push) and assert both lists (by 'is in' or 'contains'), but this does'nt work. Does anyone know advice for this problem?

browser.elements('css selector', ".p-menuitem-text.ng-star-inserted", elements => {
                let list = ['AGB', 'Datenschutz', 'Impressum'];
                elements.value.forEach(element => {
                   console.log(Object.keys(element)[0]);
                   let key = Object.keys(element)[0];
                   let id= element[key];
                    
                    
                  browser.elementIdText(key, function(result){
                        let i = result.value;
                        console.log(i);                       
                        })                                   
                })
                console.log(list)
            })          

This is my current output:

Thanks for help.

about 4 years ago · Juan Pablo Isaza
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