1

Closed

v0.4, Can't enter Cyrillic/Japanese text into an edit box.

description

Hello, I'm using following mthod for typing a value into an edit box:
 
    public void TypeText(string inputText)
    {
        AutomationElement.SetFocus();
        Keyboard.Type(inputText);
    }
 
it works for numerics and Latin characters, but invoking
 
TypeText("ФЫВА") or TypeText("十") doesn't, the field-under-test is not populated.
 
Looks like VkKeyScan(char ch) works only with Latin.
Are there any work-arounds?
Closed Feb 10, 2011 at 3:45 PM by ivom
TestApi 0.6 now supports input injection of non-ascii strings.

comments

ivom wrote Jun 22, 2010 at 9:42 PM

Hello there,

As you have undoubtedly found out, the input injection API currently do not support non-ASCII sequences. The API fundamentally only supports the Keyboard.Type(Key); pattern i.e. -- we press/release a key on the keyboard. The K.T(string) support we provide is just a helper -- in this sense "string" is not a character string but a sequence of key strokes.

The best work-around I can propose is:
  1. use Keyboard.Press/Release sequences to switch to your target keyboard layout
  2. Use Keyboard.Type(Key[]) to programatically press the keys that will produce the desired localized string (obviously you can use K.T(string) too feeding in the pseudo ascii string that will produce the desired output)
Horrible hack, I know, but should work.
I have pinged our text expert to see whether we can do something to fix this.

NLord wrote Jul 5, 2010 at 7:27 AM

Thank you for the clues!
So far, we've been able to populate some fields using ValuePattern:
            var valuePattern = elementUnderTest.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;

            if (null != valuePattern)
            {
                valuePattern.SetValue(value);
            }

ivom wrote Aug 11, 2010 at 5:53 PM

Btw, just to close down this thread, we have implemented support for non-ASCII characters and will release this support with the next version of TestApi.
Ivo

wrote Feb 10, 2011 at 3:45 PM

wrote Feb 14, 2013 at 9:08 PM

wrote May 16, 2013 at 11:02 AM