Forum Discussion
TanyaYatskovska
Alumni
10 years agoHi Tandreys,
Could you please share the problematic code with us?
rrivest
10 years agoContributor
The basic problem is the DOM Model not updating fast enough.... this often occures in IE....
Instead, use a timed search for that xPath..... Here's a sample code in C# that I use as a generic function
function TimedSearchXPath(msdelay,source,ElementType,StrValue) {
var ellapse = HISUtils["StopWatch"];
ellapse["Start"]();
var UIObject = null;
while ((UIObject == null) & (ellapse["Split"]() < msdelay)) {
var UIObject = source["FindChildByXPath"]("//"+ElementType+"[contains(@data-ui-test,'"+StrValue+"')]",true);
}
if (UIObject == null) {
Log["Message"]("Search delay has expired");
return null;
}else
return UIObject;
}