Using data from excel sheet for FindChild and passing as regex
Thanks for helping. I am using a findChild method and passing in the properties from excelsheet.
Set Loading= Aliases.DataAcquisition........
PropArray = Array("UITracingText")
ValuesArray = Array("*Loader 01*") ----> This value would need to come from an excel sheet Driver.Value(1)) but needs to be able to match part only Loader 01 as UITracingText is a long string.
Set Loading = Loading.FindChild(PropArray, ValuesArray, 10000)
ValuesArray = Array("*Loader 01*") ----> This value would need to come from an excel sheet Driver.Value(1)) but needs to be able to match part only Loader 01 as UITracingText is a long string. If i dont use the value from exel sheet, then i can simple make it ValuesArray = Array("*Loader 01*") but i only want string which are matching.
Thanks for helping.
Solved! Go to Solution.
Simply concatentate the string...
ValuesArray = Array("*" & Driver.Value(1) & "*")
This will put the value from that column in the array appropriately.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
If I understood correctly, need to get "Loader 01" text from a long string and paste to the "FindChild" method
You can try this code:
Dim regEx, Matches, value
Set regEx = New RegExp
regEx.Pattern = "Loader \d\d"
Set Matches = regEx.Execute(Driver.Value(1))
if (Matches.Count <> 0) then value = Matches.Item(0).Value
Set Loading = Loading.FindChild("UITracingText", "*" + value + "*", ...)
Thank you tristaanogre, it is now working as expected. One more thing that i have learnt 🙂