We need to automate test scripts that runs multiple environemnts like US, German etc.So I am trying to write a script to click on Devx ribbon items that works in all locals.I found one commaon property called "Name" and I am looping through ribbon items to get a name and trying to click on that.
1.I tried Perform click but test execute not able to proceed further after perform click so daily execution is getting struck.
But there is no click method for RibbonItem.
3.There is click item mothod for RibbonControl but it takes either index or text.
if I try RibbonControl.clickitem() I am not able click on items of item.
Is there any other I can click Ribbon item here?
If I record then this how it is generating code
// Get the tool bar and item key and click on the item
var itemsListCount = RibbonControl.Items.Count;
//Loops throgh items and gets the position and clicks on it
if(tempKeyValue == Name)
//Below PerformClick Action makes TC to get stuck after the click action
Check whether RibbonItem is an Object/Variable.
I'm not really clear on the problem. but try using descriptive programming.
Use FindAllChildren to find the objects that display on the list of Object based on the property. Try to print the Name.
then use FindChild using the Name property and other few properties to click on the Element.
If this doesn't help try to use Visible or VisibleOnScreen property which may try to identify the property and Click.
Item will not have a "Click" method because it is a data item, not an on screen component. So, TestComplete will not "wrap" a Click method on it.
You've already discovered that ClickItem is the means to click on the desired option. Because they run similar to a menu, each sub-option in the menu is separated by a verticle pipe. So, in your example from recording, TestComplete will click on Print Preview followed by Document followed by Save. This is how you click on items in a ribbon control.
So... to solve your problem, what you need to do is pass in the item as the full path for the location (US, German, etc).
code would be, simply
You would just pass in the following
US : Name = 'Print Preview|Document|Save'
German: Name = 'Druckvorschau|Dokumentieren|sparen'