Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not get or set value of Spinner inputs #45

Closed
jmaxxz opened this issue Mar 11, 2017 · 5 comments
Closed

Can not get or set value of Spinner inputs #45

jmaxxz opened this issue Mar 11, 2017 · 5 comments

Comments

@jmaxxz
Copy link
Contributor

jmaxxz commented Mar 11, 2017

FlaUI appears to be unable of getting or setting the value of a numeric spinner control in a windows forms application.

In UIA2 note that the edit control inside of the combo-box does not show up:
image

In UIA3 it shows up in the inspect tool:
image

However, the edit control which contains the value does not seem to be target-able by code
image

branch with spinner on win forms app

My attempts to select the current value:

        [Test]
        public void Spinner()
        {
            var comboBox = App.GetMainWindow(Automation).FindFirstDescendant(cf => cf.ByAutomationId("numericUpDown1"));
            Assert.IsNotNull(comboBox);

            var edit = comboBox.FindFirstDescendant(cf => cf.ByControlType(ControlType.Edit));
            Assert.IsNotNull(edit);

            var value = comboBox.AsComboBox().EditableText;
            Assert.AreEqual("42", value);

            var value2 = edit.AsTextBox().Text;
            Assert.AreEqual("42", value);
        }
@Roemer
Copy link
Member

Roemer commented Mar 11, 2017

It seems that it is broken in UIA2. In UIA3, I can get the edit correctly and get/set values (Windows 10). I'll investigate a bit more but more but I guess there is nothing we can do.

@jmaxxz
Copy link
Contributor Author

jmaxxz commented Mar 11, 2017

@Roemer test code does not work on my windows 10 environment, what code did you use to get/set values?

UIA3 works, a note to users using powershell remember to shutdown powershell ISE completely when switching form UIA2 to UIA3. A process that was using UIA2 can not use UIA3. (unless separate app domains are used?)

@Roemer
Copy link
Member

Roemer commented Mar 11, 2017

var spinner = App.GetMainWindow(Automation).FindFirstDescendant(cf => cf.ByAutomationId("numericUpDown1"));
Assert.IsNotNull(spinner);
var edit = spinner.FindFirstDescendant(cf => cf.ByControlType(ControlType.Edit)).AsTextBox();
Assert.IsNotNull(edit);
edit.Text = "42";
Assert.AreEqual("42", edit.Text);

@Roemer
Copy link
Member

Roemer commented Mar 11, 2017

You don't get min/max and such with that but at least the value.

@Roemer
Copy link
Member

Roemer commented Mar 13, 2017

Problem was that UIA2 was loaded into the process already and then UIA3 was loaded (which then still worked on UIA2). So getting/setting the value works with UIA3.

@Roemer Roemer closed this as completed Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants