Skip to content

Getting Started

After you installed this package, the next step is to import the package into your code and start using the functions.

from botcity.plugins.recorder import BotRecorderPlugin

As a demonstration of the library, let's build a simple example together that will do something cool .

The Demonstration Bot Code

Using our Template Project, create a new Desktop project.

Now change your code to look like the code below.

class Bot(DesktopBot):
    def action(self, execution=None):
        # Define the URL with the search term `countdown timer 5 minutes`.
        url = "https://www.google.com/search?q=countdown+timer+5+minutes"

        # Invoke the browser to open the URL.
        self.browse(url)

        # Wait for a couple of seconds with the page open.
        print("Waiting for a little bit...")
        time.sleep(10)

Adding the Recorder

To add the recorder we just need to insert the highlighted lines into the code.

# Import the recorder.
from botcity.plugins.recorder import BotRecorderPlugin


class Bot(DesktopBot):
    def action(self, execution=None):
        # Define the URL with the search term `countdown timer 5 minutes`.
        url = "https://www.google.com/search?q=countdown+timer+5+minutes"

        # Instantiate the recorder
        recorder = BotRecorderPlugin(self, "test.avi")

        # Start recording
        recorder.start()

        # Invoke the browser to open the URL.
        self.browse(url)

        print("Waiting for a little bit...")
        time.sleep(10)

        # Stop the recorder
        recorder.stop()

Next Steps

As you saw above, you can easily add the BotRecorderPlugin to any BotCity automation project. It will also work with Web automations both in headless and headful modes.

Check our examples and experiment with the API. Let us know where it can be improved.

Have fun automating!

Back to top