Not able to click on ribbon items
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.
2.I tried
var RibbonItem=RibbonControl.Items.Item(i);
RibbonItem.Click();
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
RibbonControl.ClickItem("Print Preview|Document|Save")
code:
function clickRibbobControl(RibbonControl,Name)
{
// Get the tool bar and item key and click on the item
var itemsListCount = RibbonControl.Items.Count;
var tempKeyValue;
//Loops throgh items and gets the position and clicks on it
for(var i=0;i<itemsListCount;i++)
{
tempKeyValue=RibbonControl.Items.Item(i).Name;
if(tempKeyValue == Name)
{
Log["Message"](i);
//Below PerformClick Action makes TC to get stuck after the click action
//RibbonControl["Items"]["Item"](i)["PerformClick"]();
var RibbonItem=RibbonControl.Items.Item(i);
RibbonItem.Click();
break;
}
}
return 0;
}