Appium WinAppDriver: How to Get Button Caption/Text?

Having located a Button Control on a Windows Form, I wish to get the Caption/Text displayed on the Button itself.

My button’s name is “B_AllRounds” and I can locate it by using:-
driver.FindElementByName(“B_AllRounds”) or . driver.FindElementByAccessibilityId(“B_AllRounds”)

the caption/text displayed on the Button is “Stop”, yet when I try:-
driver.FindElementByName(“B_AllRounds”).Text

the name of the Button is returned, ie “B_AllRounds”, not the text (caption) of the Button, ie “Stop”.

Does Appium/WinAppDriver provide a method which returns the Caption/Text displayed by the Button?

hello have you tried with …
String button = driver.findElement(AppiumBy.accessibilityId(“B_AllRounds”)).getText();
Assert.assertEquals(button,“Stop”);

Yes that returns “null”.

It’s quite interesting, I used to be able to to retrieve the caption on this button by calling it as follows:-
driver.FindElementByAccessibilityId("…").Text

when the Button was placed directly on a Windows Form such that its ‘Parent’ was the form.

However since moving the button onto a UserControl and with the UserControl located on a TabPage in a TabControl, the above call returns “null”.

inspect.exe shows the value “null” when inspecting the Button control.

So this looks like being a WinAppDriver issue.