Skip to main content
Version: 23.3

How do I use non-English keyboards with Eggplant Functional?

Users working in languages other than English may find that not all characters that they ask Eggplant Functional to type are reproduced on the SUT. Which characters are typed and which are not is dependent on the whether you are connected via Remote Desktop Protocol (RDP) or Virtual Network Computing (VNC) and the VNC server against which you are running. There are several approaches for dealing with this issue as follows:

You might find that it works best to combine the techniques described here. If you find a situation that is not handled by the approaches described here, contact Eggplant support, and we'll be glad to help you find the answer.

note

In version 16, Eggplant Functional added support using non-US English keyboards with RDP connections to SUTs. See Eggplant Functional Support for Non-US English Keyboards for more information.

RealVNC Server

The simplest approach for users of non-English keyboards is to connect via VNC using the RealVNC Server. RealVNC will automatically produce most characters that you will send using the TypeText command, including the unicode characters common to languages such as French, German, and Swedish. Characters that require modifier keys to type on their native keyboards (which unfortunately includes the "@" symbol in some languages) cannot be typed directly using this approach and will require a workaround as described in the Translate Function() below.

Translate() Function

If you are only able to use RDP connections, then you must currently use a workaround in order to type non-English (i.e., non-ASCII) characters. We've created a translate function() that replaces the characters that you want to type with the characters necessary to display them on the SUT. The example translate() function shown below is designed to work for German keyboards:

Translate function() example for German keyboards

function translate myString
put (Ä:>,Ö:":", Ü:"{", Y:"Z", Z:"Y") into utranslations
put keys(utranslations) into utransChars
put ("ß":"-", "?":"_","-":"/") into translations
put keys(translations) into transChars
repeat with each character of myString by reference
if it is in utransChars considering case then
put utranslations.(it) into it
else if it is in transChars considering case then
put translations.(it) into it
end if
end repeat
return myString
end translate

The function uses some advanced SenseTalk syntax. But if you're using German keyboard settings you can just plug it into your script and it should work. You would use this function by inserting it in your typeText commands like this:

typetext translate("welche Straße?")

If you put this call and the above function in a script and run it against your SUT, you should see this typed:

welche Straße?

But what the typeText command will actually be sending is as follows:

welche Stra-e_

The text is passed through the translate function() before being sent to the SUT and then the converted string is returned to the typeText command.

Similarly if you were to enter:

typetext translate("-5")

Eggplant Functional would send:

/5

which would result in the desired "-5" being typed on the SUT.

Here's the same function edited for Norwegian, which requires even more character translations:

Translate function() example for Norwegian keyboards

function translate myString
put (Å:"{", Æ:>, Ø:":") into utranslations
put keys(utranslations) into utransChars
put ("\"":"@", "&":"^", "'":"\", "(":"*", ")":"(", "+":"-", "-":"/", "/":"&", "=":")", "?":"_", "\\":"=", å:"[", "|":"`","¤":"$", "§":"~", æ:"'", ø:";","*":"|", ":":">", ";":"

put keys(translations) into transChars
repeat with each character of myString by reference
if it is in utransChars considering case then
put utranslations.(it) into it
else if it is in transChars considering case then
put translations.(it) into it
end if
end repeat
return myString
end translate

Here's a demonstration of how the Norwegian translate() function works:

typetext translate("Havørna på Håøya er et spektakulært syn")

Will actually send this:

Hav;rna p[ H[;ya er et spektakul'rt syn

Note that you can only use the translate() function with scripted commands—it won't help with live typing and it can't be called as you generate typeText commands. You can still generate the commands using the characters you want, but some of them will type the wrong things as the generated commands are executed. You'll need to edit the generated script to include the calls to the translate() function.

As noted, there is no "@" sign typed by the above code. On many keyboards, the "@" is the key produced by some key in combination with AltGr. This is cannot be typed through Eggplant Functional over an RDP connection, but the "@" sign can be typed directly over a VNC connection using RealVNC. The solution described below will also allow you to send the "@" sign and any other characters without the translate function() whether you are using RDP or VNC.

Use remoteClipboard

Another option is to put the text that you want to type onto the clipboard of the SUT and then paste the value where you want it using remoteClipboard. Here's an example:

remoteClipboard example for putting text on the SUT

  Set the remoteClipboard to "someone@somewhere.de"
click "where you want to type"
typeText controlKey, "v" // paste the string

This can be written as a command that can be called instead of typeText to perform the steps above:

  click "where you want to type"
pasteText "someone@somewhere.de"
on pasteText string1
set the remoteClipboard to string1
typeText controlKey, "v" // paste the string
end pasteText