Forum Discussion
- Mr_BroFrequent Contributor
Hi Arunachalam ,
cau you please try using the below code and let me know if its solving your problem or not.
Sys.Browser("chrome").Page("*")FindChild("idStr", "ext-gen*", 10); OR Aliases.FindChild("idStr", "ext-gen*", 10);
Kind Regards,
Sathish Kumar K
Thanks for your suggestions, K_Sathish_Kumar, Wamboo!
Arunachalam, do they help you resolve the issue?
- WambooCommunity 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!
- WambooCommunity Hero
Is any part of this ID constant? e.g. 'ext-' ?
- ArunachalamOccasional Contributor
(ext-gen1454) Here that bolded characters are "ext-gen" only constant value. The numeric value changes every time.
- WambooCommunity Hero
Try to find this element with this method:
Aliases.Find("YourID", "regexp:(ext-gen)", 'depthValue');