This project is read-only.

Capturing text from a Textbox

Aug 3, 2009 at 4:23 PM


I am new to White and trying automate Calculator. I am not able to verify the result due to following issues

1. Not able to find Id (Caption) for the text box present in the Calculator.

I am using Spy++ for finding the UI Elements. Below is the code i am using

Application application = Application.Launch(@"C:\WINDOWS\system32\calc.exe");
            Window window = application.GetWindow("Calculator", InitializeOption.NoCache);
            Button one = window.Get<Button>("1");
            Button plus = window.Get<Button>("+");
            Button two = window.Get<Button>("2");
            Button equal = window.Get<Button>("=");
            TextBox result = window.Get<TextBox>(" "); // what should i put in the bracket so that it can be identified.
            Assert.AreEqual("3", result.Text);




Aug 4, 2009 at 4:33 AM


            TextBox result = window.Get<TextBox>(SearchCriteria.ByAutomationId("403")); // what should i put in the bracket so that it can be identified.
            Assert.AreEqual("3.  ", result.Text);

TextBox result = window.Get<TextBox>(SearchCriteria.ByAutomationId("403"));

TextBox result = window.Get<TextBox>("");

you can try anyone of above.


Aug 4, 2009 at 7:55 AM

Thanks Vivek. It worked.

But can you tell me how did u get the AutomationId=403. As i am uinsg Spy++ to identify the captions and dont see anything like Automationid in it.




Aug 4, 2009 at 8:34 AM

Hi I'm not sure but Spy++ is not UI Spy.

As I can see Spy++ does not now anything about UIAutomation so it does not recognice the automation ID

Try UI Spy (as Part of the Mircosoft SDK) or easier