Using data from excel sheet for FindChild and passing as regex
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using data from excel sheet for FindChild and passing as regex
Hi Everyone,
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.
Sudha
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Simply concatentate the string...
ValuesArray = Array("*" & Driver.Value(1) & "*")
This will put the value from that column in the array appropriately.
Robert Martin
[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
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
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 + "*", ...)
...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you tristaanogre, it is now working as expected. One more thing that i have learnt 🙂
