Forum Discussion
AlexanderM
15 years agoStaff
Hello Davina,
As I mentioned in my reply in another thread, your assumption is correct - the IDs are not static, and it is not reliable to use them for object identification.
In your case, you can identify the element by its class and innerText properties:
function Test1()
{
var p = Sys.Process("iexplore");
var page = p.Page("*");
var PropArray = new Array("className", "innerText");
var ValuesArray = new Array("hyperlink report-link list-panel-row", "My Link Text");
var ConvertedPropArray = ConvertJScriptArray(PropArray);
var ConvertedValuesArray = ConvertJScriptArray(ValuesArray);
var MyLink = page.Find(ConvertedPropArray, ConvertedValuesArray, 5);
if (MyLink.Exists)
Log.Message("Object found", MyLink.FullName);
else
Log.Error("The object is not found");
}
function ConvertJScriptArray(AArray)
{
// Uses the Dictionary object to convert a JScript array
var objDict = Sys.OleObject("Scripting.Dictionary");
objDict.RemoveAll();
for (var j in AArray)
objDict.Add(j, AArray);
return objDict.Items();
}
I hope this helps.
Related Content
- 4 years agomehdisinger
- 2 months agoStoplight
Recent Discussions
- 12 hours agovladd1