0

I obtained window and the spinner object:

var OrderWindow = AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "*NAME*"));

var numberOfXX = OrderWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "*NAME*"));

then I am accessing spinner RangeValuePatterm:

RangeValuePattern value = numberOfXX.GetCurrentPattern(RangeValuePattern.Pattern) as RangeValuePattern;

And i should be able to use simple:

value.SetValue(5);

To modify its value, but it is not working. I am getting an exception of type 'System.ArgumentOutOfRangeException' - Value is greater than Maximum. (What is true, but I don't know how to change maximum allowed value...).

Also I have no idea how to get its current value, since simple:

value.Current.Value

always return 0, regardless what value is entered. I can simply send keys to set value of a spinner instead accessing it via UIAutomation, but I don't know hot to read out the actual value of the spinner → thus can't check it if it is correct.

MichalH.
  • 29
  • 1
  • 5
  • UI Automation automates the way a user would use an app. Since a user cannot possibly change the maximum value of a spinner, your app cannot either. If you could then that would end badly when the app gets a value that it does not expect. – Hans Passant Apr 29 '14 at 12:10
  • Thanks, I thought so, but it was worth to play with it. – MichalH. Apr 29 '14 at 12:28
  • i need the value of spinner is their any solution it also not show the edit control in it – nouman arshad Jun 23 '16 at 09:48

0 Answers0