-1

My WPF Windows Desktop application is with touch support - so when I tap on TextBox the keyboard pops up. I'm trying to write a test using Windows UIAutomation for my WPF application. I want to "tap" on TextBox using UIAutomation and check if the screen keyboard actually pops up. How can I do it? I don't want to use WinAPI for that. Thank you!

Sergey Lobanov
  • 365
  • 3
  • 14
  • You can try the "Inspect" tool from SDK https://learn.microsoft.com/en-us/windows/win32/winauto/inspect-objects or the more recent "Accessibility Insights for Windows" https://accessibilityinsights.io/docs/en/windows/overview/ and check what patterns are proposed and test them directly w/o writing any single line of code. – Simon Mourier Nov 22 '21 at 18:28
  • @SimonMourier Thank you for AccessibilityInsights tool, its very nice! But for TextBoxes there are mostly TextEditPattern and ValuePattern and I can't find anything related to invoking a tap on textbox to let Windows knows that I'm willing to interact with this control and launch virtual keyboard. – Sergey Lobanov Nov 22 '21 at 19:06
  • Well, it seems like there's no pattern for tap... – Simon Mourier Nov 23 '21 at 06:36

1 Answers1

0

Seems like UIAutomation has no ability to tap/use touch. We will use WinAPI do to that (already tested, it works). The solution can be found here: https://github.com/GuOrg/Gu.Wpf.UiAutomation/blob/c0109f39062e254b3eae40275730f0e9f7efce6e/Gu.Wpf.UiAutomation/Input/Touch.cs

Sergey Lobanov
  • 365
  • 3
  • 14