Skip to content

Recorder

The BotCity Recorder plugin allows you to record your Bot actions in a video.

It works with Desktop as well as Web automations, even in headless mode.

This is extremely useful for debugging, documenting and testing your Bot.

Installation

pip install botcity-recorder-plugin

Importing the Plugin

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

Recording a Bot

To add the recorder we just need to perform 3 simple steps:

  • Instantiate the Plugin
  • Invoke the Start method
  • Invoke the Stop method

Instantiate the Plugin

# Instantie the bot
bot = DesktopBot()

# Instantiate  the recorder
# Required parameter: bot with the process to be recorded
# Optional parameter: path and file name with extension
recorder = BotRecorderPlugin(bot, r"resources\test.avi")

Starting and Stopping the Recording

...

# Start the recording
recorder.start()

...

# Stop the recording
recorder.stop()

Complete Example

from botcity.core import DesktopBot
from botcity.plugins.recorder import BotRecorderPlugin


def main():
    # Instantiate the DesktopBot
    bot = DesktopBot()

    # 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 with the bot and file
    recorder = BotRecorderPlugin(bot, "test.avi")

    # Start recording
    recorder.start()

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

    print("Waiting for a little bit...")
    bot.wait(10000)

    # Stop the recorder
    recorder.stop()