microsoft / WinAppDriver

Windows Application Driver
MIT License
3.7k stars 1.4k forks source link

WinAppDriver selected text - caret position - Select a text #951

Open sayedsaad07 opened 5 years ago

sayedsaad07 commented 5 years ago

We are re-writing our UI Automation for both Winforms and WPF apps using WinAppDriver instead of using CodedUI. The main challenges we have are finding a clean way to

  1. Get selected text.
  2. Get the caret index within the textbox.
  3. Select a text in a textbox by passing start index, and length

I couldn't find a clear way in winappdriver so I end up writing some code in both WPF and Winforms to populate selected text and caret index in another textbox. Which is a dirty solution and very confusing to my app users of course.. Any suggestions??

hassanuz commented 4 years ago

AFAI, there isn't anyway for WinAppDriver to directly parse through text or analyze individual letters within a textbox.

Super workaroundy, but you could try copying the text in the textbox, and then accessing (reference) from your test framework to process as needed.