Forum Discussion
TanyaYatskovska
SmartBear Alumni (Retired)
Thanks for your suggestions, K_Sathish_Kumar, Wamboo!
Arunachalam, do they help you resolve the issue?
Wamboo
5 years agoCommunity Hero
Following the requests related to the example of the code found in the dynamic elements on the page, he wants to share the example functions:
1) If you are expecting one of several elements on a page, e.g.
On the form you can see one of many (known fields, e.g. text fields) use this function:
/* "paremeters": "[alias(COMObject, propNames[[]], propValues[[]], depth(number), refresh(bool)]", "example": "searchForDynamicAnchor(Alias.mainForm, [["ClassName", "Parent.ObjectIdentifier"], ["TcxGridSite", "grdUstawionePar"]], [[ClassName", "Parent.ObjectIdentifier"], ["TcxGridSite2", "grdUstawionePar2"]], 8)", "result": "COMObject", */ function searchForDynamicAnchor(alias, propNames, propValues, depth, refresh = true) { for (var i = 0; i < propNames.length; i++) { var anchor = alias.Find(propNames[i], propValues[i], depth, refresh); if (anchor.Visible === false) { continue; } else { return anchor; break; } } }
second code example in JS:
var variableName = () => Unit.searchForDynamicAnchor(Alias, [["ObjectIdentifier"], ["ObjectIdentifier"]], [["edtChar"], ["edtNumber"]], 3);
2) If you see a field on your website that has a field (e.g. a piece of "id" constant), then extract the code from my previous post, that is:
var variableName = Aliases.Find("YourID", "regexp:(ext-gen)", 'depthValue');
I hope this will help solve the problem.
Good luck!
Related Content
- 4 years agoAmna
- 2 years agothaidy
- 4 years agosaranyanirmal
Recent Discussions
- 18 hours agojstaehlin
- 2 days agoAivanitskiy