Is there a way to perform an action at a position which is relative to the object AND not within the bounds object (perform an action on a secondary object which is located x/y distance away from the...
If your developers are still making changes to this control, then you should ideally push for the changes to be made, to either group the controls or provide an automation id. It will take less than a minute for the developers to implement this!
Thank you everyone for all the help. After reading what everyone had to say, I could see there was no way to do this via keyword features so I scripted it out. Thanks again for all the help figuring this out. It would be nice to be able to just find an object relative to another object via a keyword feature; oh well. I tried the OCR Actions and it too seems to only work within the object that you extracted the text from (yes, poor naming or no naming makes things A Lot harder).
function testing(rowLabel)
{
// --- 1. Declaration section
//var rowLabel = "Name"
var table = Aliases.Viewport.ViewportWindow1.ViewportWindow2.SchematicWindow.zshowDataGrid;
// --- 2. Search the table for the row contianing the text, 'rowLabel' in the Name column
var propertyNames = new Array("ClrClassName", "Text");
var propertyValues = new Array("TextBlock", rowLabel);
var labelTextBlock = table.FindAllChildren(propertyNames, propertyValues, 6);
// --- 3. Get the parent row for this item
var rowContainingLabel = labelTextBlock[0].Parent.Parent.Parent.Parent;
// --- 4. Get Cell in column 2 found in this row
var propertyNames = new Array("ClrClassName", "WPFControlOrdinalNo");
var propertyValues = new Array("DataGridCell", "2");
var cellInColumnTwo = rowContainingLabel.FindAllChildren(propertyNames, propertyValues, 3);
// --- 5. Get the textblock in this cell
var propertyNames = new Array("ClrClassName", "WPFControlName");
var propertyValues = new Array("TextBlock", "_textBlockValue");
var textBlockCorrespondingToLabel = cellInColumnTwo[0].FindAllChildren(propertyNames, propertyValues, 7);
// --- 6. Finally get the text (or set the text if needed) for the field
var value = textBlockCorrespondingToLabel[0].WPFControlText;
// --- 7. Return retrieved value if needed
return value;
}
If your developers are still making changes to this control, then you should ideally push for the changes to be made, to either group the controls or provide an automation id. It will take less than a minute for the developers to implement this!