Kryptonian
Kryptonian

Reputation: 870

Ranorex- Issue in casting Adapter to UIAutomation

I am creating an button for which I need an automation element, creation

Adapter adapter= Host.Local.FindSingle<Adapter>(path)

then

var uiAutomation=adapter.As<UIAutomation>();

This conversion is unsuccessful.What I am doing wrong here, Is there any other way to get the automation element from adapter? I need automation element to GetClickablePoint() and some other properties. Also have tested

Unknown unknown = path;
var uiAutomation = unknown.As<UIAutomation>()
uiAutomation.AutomationElement;

Which also returns null on casting.

Upvotes: 0

Views: 583

Answers (2)

Thierry Br&#233;mard
Thierry Br&#233;mard

Reputation: 899

You should not mix Ranorex with UiAutomation. Ranorex do not want you to use UiAutomation because you could avoid using their software. If you still want to use Ranorex, it provides all the methods to interact with the adapters. The best thing is to investigate using their Ranorex studio : create a scenario, build it and look at the source code generated to undertand how to interact as it is clearly not obvious to do.

Upvotes: 0

user1982826
user1982826

Reputation: 359

I'm not sure what you actually want to do, but there are 3 different plug-ins in Ranorex for recognizing WPF elements. You only need the UIAutomation implementation if you want to use the WPF legacy setting. The question is why do you want to use the legacy plug-in? Did you try to change the setting to WPF Improved]1in the settings Dialog and check if the attributes are available?

Upvotes: 1

Related Questions