Different results when running from command line


I have to use a jawa.rb event for keypress for a long dropdown list. It does works correctly everytime the test script is run from the Katalon studio, however, often fails, selecting the wrong person from the list (each time it is different), when the script is run from the command line.

The code example is here:

import java.awt.Robot as Robot

import java.awt.event.KeyEvent as KeyEvent

Robot rb = new Robot ()

for (def index : (0…36))





When run from the command prompt, it often goes past the 36-th line, selecting 43, 47, or 51 for example. I tried to add wait command between the keypresses, but it does not seem to help. Anyone has an idea why is it happening?