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

137
Vistas
Assert a script is present on the page using nightwatchjs

I'm using nightwatchjs and trying to test whether a javascript script is present on a page or not.

Below is the html;

enter image description here

and I need to test that this is present on a particular page.

I understand that I could use Xpath (for example) and simply assert the following;

browser.assert.elementPresent('/html/head/script[10]/text()')

However, this isn't really practical as scripts are often inserted before this script in due course which would fail the test due to the xpath of this script changing.

So, is there a way that I can pick out a certain part of this inserted javascript script (highlighted in yellow in the image above) and assert against this, rather than the whole script? This would then make the test far less brittle.

Many thanks

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