Is it possible to place a variable within an object path and use the Set Variable Value to define?
I have an action to click on a particular button named the following
Aliases["LocationManager"]["HwndSource_Window"]["WindowLocationManagerQa20151Version116115C"]["PrismShellWindowContent"]["ContentRegion"]["ModalRegionsControl"]["MainContainer"]["ModalContainer"]["Modal"]["ViewBorder"]["Grid"]["DockPanel"]["Content"]["AreaSelectionRoot"]["ContentControl"]["ContentResolver"]["StationSelection"]["StackPanel"]["CodeSelection"]["StackPanel"]["Grid"]["Grid"]["cropSelection"]["CropSelection"]["grid"]["ListBox"]["ListboxitemCorn"]["StackPanel"]["TextblockCorn"]
Is there a way to place a variable at the end of this object path for example
Aliases["LocationManager"]["HwndSource_Window"]["WindowLocationManagerQa20151Version116115C"]["PrismShellWindowContent"]["ContentRegion"]["ModalRegionsControl"]["MainContainer"]["ModalContainer"]["Modal"]["ViewBorder"]["Grid"]["DockPanel"]["Content"]["AreaSelectionRoot"]["ContentControl"]["ContentResolver"]["StationSelection"]["StackPanel"]["CodeSelection"]["StackPanel"]["Grid"]["Grid"]["cropSelection"]["CropSelection"]["grid"]["ListBox"]["ListboxitemCorn"]["StackPanel"][%"CROP"%]
Then use Set Variable Value within a keyword test to define what the final path would be like
Set variable Value | CROP [Project] | "TextblockCorn"]
This way I could use variables within keyword tests to define which which object I would like to select as I test the application
We did something similar, but we built a string out of the known part of the object (Aliases["LocationManager"] etc.) and added the variable to the end, then changed that to the object with eval
for example (with your alias string shortened):
set a string variable
MyCropString = "TextblockCorn"
set an object variable
MyObjectString = eval("Aliases["LocationManager"]" + Project.Variables.MyCropString)