问题
I am using Java Standalone APIs of Sikuli to automate my application.
I don't know how to provide/feed some text to any text-fields using this.
回答1:
Assuming that the cursor is currently active in a text field:
Keyboard kb = new DesktopKeyboard();
kb.type("Hello world");
Or, assuming that the field accepts paste and that you don't need to simulate the individual key-presses
kb.paste("Hello world");
If you have a set of fields and tab moves between them, you can do
kb.paste("Hello");
kb.type(Key.TAB);
kb.paste("World");
回答2:
Since the question is quite broad to answer, I'm giving you some useful links. You can find the Java development setup basis on the Sikuli Documentation.
Here's a more in-depth tutorial that also covers your exact problem, and all the available Javadocs.
Just use the type()
method on the desidered locator.
With Sikuli-api try
Keyboard keyboard = new DesktopKeyboard();
keyboard.type("abc");
https://answers.launchpad.net/sikuli/+question/218670
回答3:
you can also use sikuli method type() in java program.
example:
Screen screen=new Screen();
1st create object for screen. then call method type() using that reference.
screen.type("your text");
来源:https://stackoverflow.com/questions/15196238/how-to-type-text-using-sikuli-java-standalone-jar