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

212
Vistas
Problem with WindowHandlers in Nightwatch.js

guys. I'm about like more than 5 hours with this problem in Nightwatch.js (javascript) and I no matter what I tried I get 2 results, couldn't find a solution.

What I wanting to do: the app that I'm trying to test opens a new windows and I need to change focus on the tab to continue the test. For the code I tried to use the following comand:

         var handle = result.value[1];
         this.switchToWindow(handle);
     })´´´

after this I recieved the following error messege:

Error while running .switchToWindow() protocol action: An unknown error has occurred – invalid argument: 'handle' 
must be a string

then I tried to convert the result to string but give the same problem 

after that I found this possible solution on internet: 

    ```var secondTab = ChromeDriver.getAllWindowHandles()[1];
    ChromeDriver.switchWindow(secondTab);
     this.demoTestAsync = async function (browser) {
         const result = await browser.windowHandles();
         var handle = result.value[0];
         browser.switchToWindow(handle);
       }´´´

then gives me the following error;
TypeError: ChromeDriver.getAllWindowHandles is not a function
   - writing an ES6 async test case? - keep in mind that commands return a Promise;
   - writing unit tests? - make sure to specify "unit_tests_mode=true" in your config.
       at Object.Agregar Vtos. Generales a Mi Calendario (C:\proyectos\NightWatch_CI\tests\ci\venc_contrib copy.js:25:34)
       at processTicksAndRejections (node:internal/process/task_queues:96:5)

At the end only gets the same results no matter what I try to do, or one or another. If someone could tell me what I'm doing wrong I would really appreaciate it.
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