Forum Discussion

Oleksandr13's avatar
Oleksandr13
New Contributor
10 years ago

TestComplete does not recognize Office Ribbon elements

We use Office Ribbon (http://officeribbon.codeplex.com/) and TestComplete does not recognize ribbon elements. Object Inspector recognizes ribbon as single element without childs. It recognizes it nam...
  • HKosova's avatar
    10 years ago

    Hi Oleksandr,

    There's no built-in recording & playback support for the WinForms Office Ribbon control, but you can automate it by using its internal properties and methods - those in the .NET category in the Object Browser.

    For example, you can access the ribbon items as:

    ribbonObj.Tabs.Item(index).Panels(index).Items(index)

    and its Quick Toolbar items as:

    ribbonObj.QuickAccessToolbar.Items.Item(index)


    From there you can get and change the item state. Examine these objects in the Object Browser to learn which properties and methods you can use for various item types.

    For example, to click a button you can use something like this:

    // JScript
    // Click the 1st button in the 1st tab
    var item = ribbonObj.Tabs.Item(0).Panels(0).Items(0);
    var bounds = item.Bounds;
    ribbon.Click(bounds.Left + bounds.Width/2, bounds.Top + bounds.Height/2);

     

    Hope this helps!


    You can also submit a feature request for adding built-in support for Office Ribbon:
    http://support.smartbear.com/testcomplete-survey
    http://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests