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

313
Vistas
How to wait for img src attribute to change using Selenium and JavaScript?

let's say I have an element:

<div>
 <img src='src1'>
</div>

and after some time src changes to some other link
so how to I wait for it (or any property in general) to change?

maybe something like this:

await driver.wait(until.elementAttributeChanged(el,'src'),3000);
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Just to make DebanjanB's answer more precise.
Since we want to indicate the changing of src attribute value of some element, we can use locator based on the value of src attribute of that element. So the code can be something like this:

let element = await driver.findElement(By.xpath('//img[@src="src1"]'));
await driver.wait(until.stalenessOf(element),1000);
about 4 years ago · Juan Pablo Isaza Denunciar

0

To wait for the src attribute of the <img> to change using Selenium and node.js you can use the following until condition:

  • stalenessOf( element ): Creates a condition that will wait for the given element to become stale. An element is considered stale once it is removed from the DOM, or a new page has loaded.

    let element = await driver.findElement(By.id('elementID'));
    await driver.wait(until.stalenessOf(element),1000);
    
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