I'm currently testing a Desktop application ( WPF applications ) using Ranorex.The application under test has some textbox that has some properties like bol , fontstyle , foreground.
I'm wondering if there is a way to access and identify WPF properties like FontStyle because UI Automation only exposes a subset of control properties. Well what I'm trying to do is write a method that get RepoItemInfo , use a Ranorex.Text adapter then get newAdapter.element.GetAttributeValue("FontStyle") but the result is always null
My Code :
Code: Select all
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" AutomationProperties.AutomationId="MainWindow">
<Grid>
<TextBox Foreground="Aqua" FontStyle="Italic" Width="200" Height="25" AutomationProperties.AutomationId="TextBox">Value</TextBox>
</Grid>
</Window>
Code: Select all
[UserCodeMethod]
public static void checkit(RepoItemInfo field)
{
Ranorex.Text yourTextBox = field.FindAdapter<Ranorex.Text>();
var yourTextBoxElement = yourTextBox.Element;
var ValueofText = yourTextBox.TextValue;
var TextForeground = yourTextBoxElement.GetAttributeValue("Foreground");
var TextFontStyle = yourTextBoxElement.GetAttributeValue("FontStyle");
}
PS: I'm using Ranorex 8.1 version
Thanks in advance
Regards,
Brahim