Sikuli does not execute the commands properly

Asked by Sander

Hi Raiman,

When I execute the following:

wait(POSTCODE)
click(POSTCODE)
type("617LZ")
type(Key.TAB)
type("34")
click(Next)

It fills in:
POSTCODE: 17IZ
NEXT FIELD: 634

So basically it is missing the character 6 that should be entered in the POSTCODE field, but is added into the next field.
After restarting it a couple of times, did not help.

Any suggestions?

earlier ticket created: #671266

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Sander
Solved:
Last query:
Last reply:
Revision history for this message
TestMechanic (ndinev) said :
#1

You are executing above code against what?

There is a chance that your app under test is switching focus. Try adding "sleep(1)" after click and type commands

Revision history for this message
Sander (sander-helsloot) said :
#2

Hi TestMechanic,

Using Safari.
Do I need to add sleep(1) after every click and type command???

Hm, I used to use Windows, that worked fine without any sleep command.
Some here and there a wait command do you have any other suggestion?

Just try to fill in a form using some input fields.

type("123") and sleep(1)
type("Key.TAB") and sleep(1)

Without using Sikuli I could Tab though all input field manually without an issue.

Revision history for this message
TestMechanic (ndinev) said :
#3

I posted similar problem back in 2017 for MacOS Sierra

https://answers.launchpad.net/sikuli/+question/562274

Revision history for this message
RaiMan (raimund-hocke) said :
#4

Since Sikuli does not know anything about timing of the underlying GUI, you have to add some wait() after an action, that should activate an input field for type (give focus) - hence BEFORE the type().

You might try with paste(text) instead of type(text).
Usually only the first field, that is activated with a click, might make problems. The subsequent type()'s after a TAB should work.

This is especially true for GUI's shown in a browser.
 SikuliX is completely visual.

 if this is not ok for you, then you have to use libraries like Selenium, that are aware of the GUI running in a browser.

Revision history for this message
TestMechanic (ndinev) said :
#5

Sander,

Try to execute following command in console and then reboot your Mac (you may need sudo)

defaults write -g ApplePressAndHoldEnabled -bool false

Revision history for this message
Sander (sander-helsloot) said :
#6

Thank you for your answers, the issue is fixed. Adding wait() methods to it and now it works properly.