I am converting pre-written UI Automation scripts written in C# using AutomationElements to get the items I want to handle. I am trying to get a Telerik RadIndicator ProgressBar TogglePattern state. I have created a custom WaitForMaxTime() method that will wait until the element is no longer busy. When I try to get the TogglePattern this is the error message I get:
The type 'System.Windows.Automation.TogglePattern' must be convertible to 'Ranorex.Adapter' in order to use it as a parameter 'T' in the generic method 'T Ranorex.Core.Element.As<T>()' .
When I try to include VisualStudio Automation DLLs, Ranorex will "purge" them at some point and I can no longer use them. Is there a way to bridge the gap between Windows Automation TogglePattern and Ranorex Adapters?
System.Windows.Automation.TogglePattern via Ranorex.Adapter
-
- Posts: 1
- Joined: Tue Oct 30, 2012 2:04 pm
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: System.Windows.Automation.TogglePattern via Ranorex.Adapter
Hello,
You could access UI Automation components of your object as shown below:
Unknown unk = "/form[@controlname='MainForm']/unknown";
var uia = unk.As<UIAutomation>()
uia.AutomationElement;
If you wanna access UI Automation Toggle components of your object you could use:
Ranorex.Button b;
var uiaToogle = b.As<UIAutomationToggle>();
uiaToogle.Toggle();
Please take a look at UIAutomation and UIAutomationToggle classes in our documentation.
Regards,
Markus (T)
You could access UI Automation components of your object as shown below:
Unknown unk = "/form[@controlname='MainForm']/unknown";
var uia = unk.As<UIAutomation>()
uia.AutomationElement;
If you wanna access UI Automation Toggle components of your object you could use:
Ranorex.Button b;
var uiaToogle = b.As<UIAutomationToggle>();
uiaToogle.Toggle();
Please take a look at UIAutomation and UIAutomationToggle classes in our documentation.
Regards,
Markus (T)