First Automation Project

0. Overview #

“ In this tutorial, we will guide you through a simple Clicknium automation script, starting from scratch, to help you become familiar with Clicknium. The script will launch a Chrome browser and search for ‘Clicknium’ on Google. ”

—— Clicknium Dev_team

1. Installation #

Please follow Quick Start first to install Clicknium and related extensions.

2. Create a Python file #

Following code will open a Chrome browser and get into Google website. (Make sure Clicknium Chrome Extension is ready.)

from clicknium import clicknium as cc, locator

def main():
    cc.config.set_license('your license key')
    tab ="")

if __name__ == "__main__":

3. Capture first UI locator #

In the next step, we need to use Locators to identity the UI element that we want to operate. Clicknium Recorder will help to catpure locators.

  • Click Capture button in LOCATORS tab of Explorer side bar or pressing `Ctrl+F10 for shortcut in VS Code.
  • Clicknium Recorder will pop up.
  • Hover mouse over the Google Search bar, it will be highlighted with a rectangle.
  • Press Ctrl+Click to capture locator for the target element, the locator will be added to the Locator Store listing in the tree area of Clicknium Recorder.
  • Capture search button with the same approach.
  • Click Complete button.

4. First line automation code #

After capturing UI locators, use Clicknium automation API and locators to input text into search bar and click search button.

  • reference locators in code by starting locator. , the following node will be listed in syntax popup for you to select and autofill.

You can add a line of sleep(3) to avoid VS Code shutting down the browser too quickly. For more about automation API, refer Clicknium Python package documents.

5. Run/Debug automation code #

  • Open related Python file, run this script by Ctrl+F5.
  • Open related Python file, debug this script by F5.
What are your feelings
Updated on 1 December 2023