Platform Android
Appium version 1.20.2
Emulator
Client langauage c#
OS Win
I need to send unicode chars to android, not as a setvalue which does sendkeys.
Exactly I need to test typing in my app and emulate human behavior in typing.
Im using c# so code is: Actions a = new Actions(driver); a.SendKeys("تست"); a.Perform();
i see uiautomator2 calls wd proxy, so I need to modify that to support unicode
[WD Proxy] Proxying [POST /actions] to [POST http://127.0.0.1:8214/wd/hub/session/elementid/actions] with body: {“actions”:[{“type”:“key”,“id”:“default keyboard”,“actions”:[{“type”:“keyDown”,“value”:“t”},{“type”:“keyUp”,“value”:“t”},{“type”:“keyDown”,“value”:“e”},{“type”:“keyUp”,“value”:“e”},{“type”:“keyDown”,“value”:“s”},{“type”:“keyUp”,“value”:“s”},{“type”:“keyDown”,“value”:“t”},{“type”:“keyUp”,“value”:“t”}]}]}
I searched in C:\Program Files\Appium\resources\app\node_modules\wd\lib
but no success
about mobile:type I get this error in c#:
OpenQA.Selenium.WebDriverException: 'An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: ‘Command ‘C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 shell input text &BioGMwYq-’ exited with code 127’; Stderr: '/system/bin/sh: BioGMwYq-: not found
Error: Invalid arguments for command: text
Usage: input [] […]
and this log in appium console:
[HTTP] --> POST /wd/hub/session/48382df8-45e2-4064-af51-63cbfb02f97e/execute/sync
[HTTP] {“script”:“mobile: type”,“args”:[{“text”:“تست”}]}
[W3C (48382df8)] Calling AppiumDriver.execute() with args: [“mobile: type”,[{“text”:“تست”}],“48382df8-45e2-4064-af51-63cbfb02f97e”]
[AndroidDriver] Executing native command ‘mobile: type’
[ADB] Typing 3 characters
[ADB] Running ‘C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 shell settings get secure default_input_method’
[ADB] The original IME is the same as ‘io.appium.settings/.UnicodeIME’. There is no need to reset it
[ADB] Running ‘C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 shell input text &BioGMwYq-’
[W3C (48382df8)] Encountered internal error running command: Error executing adbExec. Original error: ‘Command ‘C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 shell input text &BioGMwYq-’ exited with code 127’; Stderr: ‘/system/bin/sh: BioGMwYq-: not found
[W3C (48382df8)] Error: Invalid arguments for command: text
[W3C (48382df8)] Usage: input [] […]
[W3C (48382df8)]
[W3C (48382df8)] The sources are:
[W3C (48382df8)] keyboard
[W3C (48382df8)] mouse
[W3C (48382df8)] joystick
[W3C (48382df8)] touchnavigation
[W3C (48382df8)] touchpad
[W3C (48382df8)] trackball
[W3C (48382df8)] dpad
[W3C (48382df8)] stylus
[W3C (48382df8)] gamepad
[W3C (48382df8)] touchscreen
[W3C (48382df8)]
[W3C (48382df8)] The commands and default sources are:
[W3C (48382df8)] text (Default: touchscreen)
[W3C (48382df8)] keyevent [–longpress] … (Default: keyboard)
[W3C (48382df8)] tap (Default: touchscreen)
[W3C (48382df8)] swipe [duration(ms)] (Default: touchscreen)
[W3C (48382df8)] press (Default: trackball)
[W3C (48382df8)] roll (Default: trackball)’; Code: ‘127’
[W3C (48382df8)] Error: Command ‘C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 shell input text &BioGMwYq-’ exited with code 127
[W3C (48382df8)] at ChildProcess. (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\teen_process\lib\exec.js:113:19)
[W3C (48382df8)] at ChildProcess.emit (events.js:203:13)
[W3C (48382df8)] at maybeClose (internal/child_process.js:1021:16)
[W3C (48382df8)] at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
about mobile:type I think problem is conflict with cmd in windows
my text converted to &BioGMwYq so the & sign is problem in cmd which waits for second command after adb not getting converted text as parameter
Thanks a lot
‘\’ did not escape that
I fixed problem for now, I’ve replaced ‘&’ with ‘~’ in utf7 encoder and in android decoder
after all replace ~ with & back on unshift method android
Could you please provide the full log? Also, have you tried to run the command C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 shell input text \&BioGMwYq- manually? What is the output there?
No log, because I tested manually in cmd:
C:\Users\user>C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 s
hell input text &BioGMwYq-
Error: Invalid arguments for command: text
C:\Users\user>C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 s
hell input text \&BioGMwYq-
‘BioGMwYq-’ is not recognized as an internal or external command,
operable program or batch file.
C:\Users\MRKP>C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 s
hell input text ^&BioGMwYq-
/system/bin/sh: BioGMwYq-: not found
Error: Invalid arguments for command: text
I added your changes to files, but it does not escape
as I see escapeArg function does not called
any build or other work should I do to test new code?
this works fine in cmd, no need to escape space I think, using ’ ’ around text is ok:
C:\Users\user>C:\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62040 s
hell input text ‘^&BioGMwYq- ^&BioGMwYq-’