Forum Discussion
Thanks for reply, Alex!
Using of FindXXX methods for dynamic pages (e.g. AJAX) actually doesn't really help in Firefox - sometimes it can't find anything even if page is already loaded. Please, look the code below for details:
[JS]
var curPage, tcObj, nativeObj;
var oFound = false;
while (!oFound) // simple condition just for example
{
curPage = Sys.Process("firefox").WaitPage("*", 1000);
tcObj = curPage.FindChild("idStr", "txtUserName", 1000); // this method sometimes return stub non existing object
nativeObj = curPage.document.getElementById("txtUserName"); // this one is always return correct object
if (tcObj.Exists)
{
oFound = true; // got it
}
else
{
aqUtils.Delay(500, "wait a bit for page loading");
}
}
In some cases FindChild() can't recognize new controls appeared on page even if it is called in a loop as in example. It looks like TC caches page's content and doesn't refresh it if actual page is updated. Therefore I've tried to use native getElement* methods but, as you said before, there are no way to convert native object into TC wrapper. So, the issue is still open and I have no ideas how to resolve it. Are there any methods to force TC to refresh page object to be able to find newly added elements on page?
And one more note, related to iterating through the elements array (my first post): I just found out that accessing to element in FF differ from that one in IE. Please, see below:
var arrayOfElements = anyElement.getElementsByTagName(tag);
for (var i = 0; i < arrayOfElements.length; i++)
{
Log.Message(arrayOfElements.getAttribute('id')); // IE variant
Log.Message(arrayOfElements.item(i).getAttribute('id')); // FF variant
}
p.s. I'm using TC 7.51, IE 7 and FF 3.5.7
upd: TC still can't find element even if I manually refresh page in FF
Related Content
- 3 years agonewbe
- 4 years agoGunacelan
- 2 years agoIlakkk
- 3 years agovargirovic
Recent Discussions
- 3 days agovladd1