Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

317
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda