Basic Sikuli Commands

sikuli keystrokes

Sikuli has multiple commands that provide easy automation when interacting with images on the screen. Here are the top commands that are used in Sikuli.

  1. click(): The click command allows you to click on anything you see on your screen. The way to use this command is to type “click(Screenshot will be in here)”. It is a very simple line of code, yet very handy when needing to click on a file/icon/link/etc.
  2. type(): The type command is when you want the bot to type out something on your screen. This is handy for having the bot type a url, information into a file, or search for an invoice number in an ERP system like PeopleSoft. Here’s an example: type(“I will automate all my work!”). This will use your keyboard to type this out in whichever location your mouse is actively clicking in. type(Screenshot of image,”text in here”) can also be used to save a step as this will click then type the text in quotes. This command and the click() will be the most used commands when navigating around websites, files, and systems.
  3. doubleClick(): if you guessed that this command double clicks for you, you guessed right! This command is similar to the click command, but instead of clicking once, it clicks twice. This is very useful when needing to open an application, as when you open an application on your desktop, you have to double click on it.
  4. rightClick(): This command allows you to right click. Let’s say you want to right click on a file to change its name or check its properties, rightClick() will do that for you. Don’t forget to have the screenshot of the whatever you want to manipulate between the parentheses.
  5. if(),elif(),else: – Any process that requires logic will need if statements. The best way to think about if statements is building out your methodology step by step. If I take this action, then I will do this. If 1=1, then run this code. Using these statements are very useful when having a process that has to complete a step if a condition exists or if it sees an image. If an if statement is not met, Sikuli will skip that line of code and move on to the next. Putting an else: statement allows you to run code in the case of the if statement condition not being met.

Related Articles

Responses

Your email address will not be published. Required fields are marked *