I just confirmed your example. It's the same for latin characters encoding. Here is @Arnoud Buzing solution from this post. Just execute the code below to fix the WebUnit fetch function. Here is an example:
StartWebSession["Chrome"];
WebExecute["OpenPage"->"https://www.google.com/maps"];
input = First@WebExecute["LocateElements"->"XPath"->"//input[@id = 'searchboxinput']"];
Now execute:
ClearAll[WebUnit`Private`fetch];
WebUnit`Private`fetch[
WebUnit`Private`sessioninfo_,
WebUnit`Private`type_,
WebUnit`Private`path_,
WebUnit`Private`data_,
WebUnit`Private`key_
] := Module[{
WebUnit`Private`res,
WebUnit`Private`fetchResult
},
WebUnit`Private`fetchResult = URLRead[
HTTPRequest[
WebUnit`Private`sessioninfo[[3]] <> WebUnit`Private`path, <|
"Method" -> WebUnit`Private`type,
"Body" -> WebUnit`Private`json[WebUnit`Private`data]
|>
], "BodyByteArray"
];
If[
!ByteArrayQ[WebUnit`Private`fetchResult],
Return[$Failed]
];
If[
ImportByteArray[WebUnit`Private`fetchResult, "Text"] === "missing command parameters",
Return[$Failed]
];
WebUnit`Private`res = ImportByteArray[WebUnit`Private`fetchResult, "JSON"];
WebUnit`Private`DebugPrint[ WebUnit`Private`format[WebUnit`Private`res] ];
WebUnit`Private`key /. WebUnit`Private`res
]
And you can test with:
WebExecute["TypeElement"-> {input, "평양"}]
or as in my case
WebExecute["TypeElement"-> {input, "São Paulo"}]
Works fine! WebExecute is cool, but it's in It first version yet. I Hope to have better sendKey in the future version, with more options as I ask in this post.
Note
1- The bug is for any entry of WebExecute using non standard characters, not just for "TypeElement". For example WebExecute["LocateElements" -> "XPath" -> "//input[text() = 'São Paulo']"]
will break either without redefine WebUnit
Privatefetch
.
2- Redefine WebUnitPrivate
fetch before StartWebSession will not work in a fresh kernel. It needs to be after StartWebSession.