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¶
# Instantiate the recorder
recorder = BotRecorderPlugin(self, "test.avi")
Starting and Stopping the Recording¶
...
# Start the recording
recorder.start()
...
# Stop the recording
recorder.stop()
Complete Example¶
# 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()