Federico Navarrete

Federico Navarrete

  • 1.9k
  • 11
  • 1.5k

UI Automation, Ribbon Control and Automation Anywhere 11

May 14 2019 1:44 PM
I am building a new bot in Automation Anywhere 11 and I have found recently a tricky situation when I'm trying to automate the Windows Ribbon.

If I have only one tab everything works as expected and I can identify all buttons inside, but if I have multiple tabs only the last tab elements are visible to the Object Cloning option, I have added unique Names, AutomationIDs, etc. And nothing has worked. This is a preview of the issue:

 
This is my example XAML code:
  1. <UserControl    x:Class="Example.RibbonMenu" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" xmlns:my="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon">   
  2.      <my:Ribbon x:Name="R1" AutomationProperties.AutomationId="R1ID">   
  3.           <my:RibbonTab Header="Tab 1" x:Name="Tab1" AutomationProperties.AutomationId="Tab1ID">  
  4.  <my:RibbonGroup x:Name="GB1" AutomationProperties.AutomationId="RG1ID">   
  5.  <my:RibbonButton Label="Button 1" x:Name="RB1" AutomationProperties.AutomationId="RB1ID" />   
  6.  </my:RibbonGroup>   
  7.  </my:RibbonTab>   
  8.  <my:RibbonTab Header="Tab 2" x:Name="Tab2" AutomationProperties.AutomationId="Tab2ID">   
  9.  <my:RibbonGroup x:Name="RG2" AutomationProperties.AutomationId="RG2ID">   
  10.  <my:RibbonButton Label="Button 2" x:Name="RB2" AutomationProperties.AutomationId="RB2ID" />   
  11.  <my:RibbonButton Label="Button 3" x:Name="RB3" AutomationProperties.AutomationId="RB3ID" />   
  12.  </my:RibbonGroup>   
  13.  </my:RibbonTab>  
  14.  </my:Ribbon>  
  15.  </UserControl> 
 
Also, I have read multiple options:
  1. UI Automation and Ribbon control
  2. XAML - Binding row and column index of cell to automation ID
  3. Unable to generate Automation ID for WPF Controls, to be used by coded UI for automation testing
  4. How can I find WPF controls by name or type?
  5. Coded Ui test unable to find the WPF Ribbon button
  6. How can i automate Ribbon UI
But nothing that I tried so far was worked until recently, I identified that the issue is connected to the last tab. Also, I tried the Legacy Option and Manage Windows Controls too. Here are some previews:

Legacy Option Enabled:


Manage Windows Controls:

 
Furthermore, another ribboned app like Paint where the buttons are recognized:



Does anyone have an idea how to fix it? Or has experienced something similar? Thanks for your help.