Not supported character in keyDown()

Asked by Mychajlo Chodorev on 2020-09-04

I'm writing a script to automatize saving of the web page. So I try to send Ctrl+s with keyDown(). It seemed to work but now I'm getting an error:

> [error] java.lang.IllegalArgumentException ( java.lang.IllegalArgumentException: Key: Not supported character: s )
> [error] --- Traceback --- error source first
> line: module ( function ) statement
> 17: main ( <module> ) keyDown(Key.CTRL + "s")
> [error] --- Traceback --- end --------------

I tried to run it both in IDE and command line with same result.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

Please try with
type("s", Key.CTRL)

Mychajlo Chodorev (ralfeus) said : #2

Same error was for type('s', Key.CTRL). But after several restarts the problem has gone. Weird...

Best RaiMan (raimund-hocke) said : #3

I have another case, where the same error was shown for a type with Key.Win.

Do you have a non-US keyboard layout?

If yes, put as second or higher entry in the layout list EN (English US) (... but do not select it ;-)

Mychajlo Chodorev (ralfeus) said : #4

Indeed I had active non-latin keyboard layout. When latin but non-English layout is active everything is ok. So only non-latin one causes problem.
Thank you

Mychajlo Chodorev (ralfeus) said : #5

Thanks RaiMan, that solved my question.