'Using FlaUI and Ranorex at the same time

I work for a company who have been developing automated test for the past 8 or so years, using Ranorex. We don't use the studio, but making our own code to find and interact with UI elements. So we have a rather extensive library. Unfortunately we need to switch UIA tool and have selected FlaUI.

My problem is, the SelectionItemPattern becomes unsupported after I have used Ranorex. Anyone have any idea on how to solve this issue, would be nice not to have to convert the entire library in one go.

Some pseudo code to show what I do.

var desktop = new FlaUI.UIA3.UIA3Automation().GetDesktop();
var flaForm = desktop.FindSingle<Fla.Window>(@"<window path>", TimeSpan.FromSeconds(5));
var docArea1 = flaForm.FindSingle<Fla.AutomationElement>(@"<pane path>", TimeSpan.FromSeconds(5));
var docWin2 = docArea1.FindSingle<Fla.AutomationElement>(@"<pane path>", TimeSpan.FromSeconds(5));
Fla.Tree tree = docWin2.FindSingle<Fla.Tree>(@"<tree path>", TimeSpan.FromSeconds(10));
var targetItem = tree.Items.Single(i => i.Name == "<itemName>");

Log.WriteLine($"DEBUG: Supported patterns\n{targetItem.GetSupportedPatterns().Select(p => p.Name).Format().Format()}");

The result is [[ LegacyIAccessible | SelectionItem | Value ]]

I then use Ranorex and find the same item again, reusing most of the previously found UI elements.

Rx.Host.Local.FindSingle<Rx.Form>(@"<Window path>", TimeSpan.FromSeconds(10));
tree = docWin2.FindSingle<Fla.Tree>(@"<path to tree>", TimeSpan.FromSeconds(10));
targetItem = tree.Items.Single(i => i.Name == "Recording Servers");
Log.WriteLine($"DEBUG: Supported patterns\n{targetItem.GetSupportedPatterns().Select(p=>p.Name).Format()}");

The result here is [[ LegacyIAccessible | Value ]]

Basically we want our automated tests to be able to use both frameworks at the same time.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source