Closed graysuit closed 1 year ago
Currently I use this as workaround:
Function Escape(Str As String) As String
Dim RestrictedChars = "~@#$%^&*()_+=-!".ToCharArray()
For Each R In RestrictedChars
Str = Str.Replace(R.ToString(), $"\{ R.ToString()}")
Next
Return Str
End Function
PassElement.SendText(Escape("~!@#$%^&*()_+=-"))
Because it is send command to Android Shell. So these spaical characters should add \
to escape...
Per my analysis this is adb issue. Currently using ADbkeybaord as helper. It works.
Function SendText(client As AdbClient, device As DeviceData, Text As String)
Return RunAdb(client, device, $"am broadcast -a ADB_INPUT_CHARS --eia chars '{ConvertToUnicode(Text)}'")
End Function
Function ConvertToUnicode(Input As String) As String
Dim Output = String.Empty
For Each c As Char In Input
Output += AscW(c).ToString() + ","
Next
Return Output.TrimEnd(","c)
End Function
Function RunAdb(client As AdbClient, device As DeviceData, cmd As String) As String
Dim receiver As New ConsoleOutputReceiver()
client.ExecuteRemoteCommand(cmd, device, receiver)
Dim Out = receiver.ToString()
receiver.Flush()
Return Out
End Function
Thank so much for great work!
Describe the bug
Is that expected we need to escape special characters ? or may be better library should do itself to be safer, right ?
Steps to reproduce the bug
Expected behavior
No response
Screenshots
No response
NuGet package version
Latest Source
.NET Platform
.NET Framework 4.6.x
Platform type
Windows
System version
windows 10
IDE
Visual Studio 2017
Additional context
No response