2

Issue
In my current project I am implementing some trivial automated tests for a video call application which runs on Android, iOS (with Unity) and Windows (WPF). To create those automated tests I decided to use Appium for several reasons. The most important one was that there is a framework which makes it easy to automate Unity apps [1]. During the login process the systems default browser will be embedded to the current view of the application. The user has to enter his e-mail address and his password. This ist the point where I am struggeling. I try to send the following string:

String eMail = "system-administrator@e-mail.de"

But appium types the following text into the textfield of the embedded browser within the WPF client:

szstemßadministrator@eßmail.de

(This is because the german keyboad is configured as default at the system settings. The result would be another if the default layout would be another one)

I figured out, that the .NET driver for Appium was designed for US keyboards [2]. So I thought it would be the best way to send unicode characters [3]. Furhtermore I tried to normalize the String I like to send before, by using java.text.Normalizer [4]. But even, if I set the recommended desired capabilities [5][6], this does not effect the result described above. It looks like there is no solution for WPF available yet [7-11].

At the moment I have implemented a method to replace the characters which results from a german layout with the equivalent of the US keyboard (i.e. 'z' -> 'y', 'z' -> 'y' or '-' -> '/'), by using StringBuilder#replace. But this feels wrong and is very system dependent. Another workaround would be to configure shortcuts at the system and switch the layout of the keyboard during the test and switch it back afterwards [12]. But this feels wrong too, because the test should not rely on system settings or change them. Maybe my research was not sufficient enough and there is a way to force Appium to send the given String as it is displayed in the code.

question: Which way could be the best to solve the issue described above?

  1. Implement a method which replaces the characters, if necessary?
  2. Create and use shortcuts to switch the keyboard of the system, if necessary?
  3. Another one?

sources
[1] Java Image Recognition
[2] Appium: Issue#380
[3] Convert string to unicode
[4] Appium: Multi-lingual Support
[5] Appium Send keys() function sending Chinese characters as part of English strings
[6] Appium: Desired Capabilities
[7] Force keyboard layout for Selenium2 sendkeys method
[8] convert at symbol ("@") to CharSequence
[9] How to send "special characters" with Python Actions Send_keys?
[10] Appium: Issue#215
[11] Appium: Issue#507
[12] Appium: WPF keyboard workaround
jtight_404
  • 51
  • 5
  • The current solution only works for non-password inputs unless Appium is not able to receive the text from a password field. – jtight_404 Oct 07 '20 at 09:12

0 Answers0