WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

[Question]About the equivalent between Inspect.exe "Name" property and WindowsElement.Text

Open phibao37 opened this issue 7 years ago • 2 comments

I"m start learning WinAppDriver and often using Inspect.exe tool to view the property of elements. I noticed that the value of property "Name" always equals to the displaying text of the element (button, label text), and it seem the same with the property "Text" of WindowsElement object in the client API library.

However, when I checking for the C# sample project Calculator test, I figure out following different:

  • In source code file "ScenarioStandard.cs" line 107/114, it state that the default value for header text of the Calculator will be "Standard", and the sample code can be run OK on my laptop.

  • But when I recheck this element with Inspect.exe tool, the value of the "Name" property is "Standard Calculator mode", and there is no other property with the value "Standard". Screenshot (2)

So, it seem the value of these property are not always the same, is it? I think that Inspect.exe is based on UIAutomation/MSAA library to obtain element information, and the same with the WinAppDriver, too. But with the above difference, it seem WinAppDriver also using some other API/library to obtain element property information (maybe via Win32 SendMessage API, I think!)

And I also want to know if I can obtain this "Text" property from Inspect.exe or other similar tool if possible.

phibao37 avatar Jul 05 '19 14:07 phibao37

Use UIRecorder to locate elements.

riccione avatar Jul 07 '19 04:07 riccione

how about xpath like this: driver.FindElement(By.XPath("//div[text()="Standard"]"));

7Agnieszka avatar Aug 05 '19 13:08 7Agnieszka