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:
Juan Pablo Isaza
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);
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);