Orchestrating and managing your Selenium automation

This is a discussion topic for the original post at Orchestrating and managing your Selenium automation - BotCity | Python RPA | Blog

Even if you haven’t built your bots with Python frameworks from BotCity, can you orchestrate the automation you already have running in production using BotCity Maestro? Here is how to do this without the need to code again the bots that already support your business and its processes.

Understanding the differences between the BotCity and Selenium frameworks

BotCity has frameworks for developing its automation with Python, such as desktop and web. The last one was built based on Selenium but improved and facilitated the usability of the commands for developers.

Here is an example of an implementation where it is necessary to open a browser with Chrome with a loaded profile:

With the Selenium framework:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

instantiates the ChromeOptions class

options = webdriver.ChromeOptions()

adds arguments for browser execution

options.add_argument(“–user-data-dir=C:\Users\lsmac\AppData\Local\Google\Chrome\User Data”)
options.add_argument(‘–profile-directory=Profile 1’)

configure the webdriver

driver = webdriver.Chrome(executable_path=“<chromedriver.exe path>”, options=options)

opens the browser at the defined url


With BotCity’s web framework:

from botcity.web import WebBot, Browser
from botcity.web.browsers.chrome import default_options
from webdriver_manager.chrome import ChromeDriverManager

instantiate the bot

bot = WebBot()

define which browser to use

bot.browser = Browser.CHROME

sets the webdriver to run by passing the Chrome Webdriver path

bot.driver_path = “<chromedriver.exe path>”

add arguments to browser execution

def_options = default_options(
user_data_dir=r"C:\Users\lsmac\AppData\Local\Google\Chrome\User Data", # if you do not inform, a temporary directory will be generated

def_options.add_argument(‘–profile-directory=Profile 1’)

define these arguments in options

bot.options = def_options

opens the browser at the defined url


These two examples do the same process, but the BotCity framework, even based on Selenium, synthesizes, organizes, and makes the methods more intuitive for developers than pure Selenium.

However, it is essential to understand that even if you already have automation running in production that was developed directly with the Selenium framework, you can also use the BotCity Maestro orchestrator to manage them.

What is BotCity Maestro

It is our orchestrator. With Maestro, you can manage your bots in a single platform with logs, alerts, and dashboards, among other features. And they can be the automation of any framework, as is the case with Selenium we are discussing in this article.

Why orchestrate and manage your bots

Keeping track of how the robots are working, significantly when several of them, can help you monitor your automation. Not just ensuring that they have or have not been executed. But understanding possible errors, at what time each robot should be executed, in what sequence, etc. This makes day-to-day life easier, allows you to act where possible problems might occur, and further improves processes that have already been automated.

Orchestration can involve both the business area and the IT team (or CoE). And some features such as automation scheduling, alert triggers for users (process started, system down, error in request), management of logs from the processes created, integrations with communication systems (Microsoft Teams, Slack, Whatsapp, and E-mail) can guarantee a scalable, centralized, and efficient operation in your company.

How do I use Maestro in my automation built in pure Selenium?

Minimum requirements

In order for you to do this process, it is important to have two basic requirements:

  • bot.py: a file with this name that will be used as input to the BotCity Runner, as if it were the “main” part of your project;
  • requirements.txt: a file with this name that contains the dependencies that are used in the code. BotCity Runner will use this file as a reference to know which packages need to be installed to run your automation code.

Creating the bot.py file

Let’s exemplify creating a bot with pure Selenium that accesses BotCity’s YouTube channel and fetches the number of people subscribed. See the implementation below.

from selenium import webdriver

sets Chrome as the browser

driver = webdriver.Chrome(executable_path=“<chromedriver.exe path>”)

access Google homepage


search for BotCity YouTube channel

search_bar = driver.find_element_by_name(“q”)
search_bar.send_keys(“BotCity RPA Youtube”)

click in the button “I’m Feeling Lucky”

feeling_lucky_button = driver.find_element_by_xpath(“/html/body/div[1]/div[3]/form/div[1]/div[1]/div[3]/center/input[2]”)

identifying the number of people subscribed to the channel

subscribers = driver.find_element_by_id(“subscriber-count”).text
print(f"Subscribers Count: {subscribers}")

close the browser


Creating the requirements.txt file

Create the file with the packages and their versions:

# configure to use a specific package 

Create a .zip file with the created files

You will get a structure similar to this:

├── bot.py
└── requirements.txt

You can see more about this in our documentation.

Deploying in Maestro

Creating the automation

The first thing to do is to identify the “Easy Deploy” option in the menu located on the left side of the screen. When you click this option, you will have to fill in the name of the automation.

Adding the bot in Maestro

In the next step, you must attach your robot (the .zip file that you created with the bot.py and requirements.txt files). Next, enter the programming language used to develop the bot, its name, and its version.

Choosing where to run

In this step you must choose in which runner your automation should run or create a new one. And then click on “deploy”.

After this, it will load a screen with a message informing you that your deployment was successful.

You can find more information about deployment and execution in our documentation.

But with these steps, you already have your automation available to be run, managed, and orchestrated by Maestro, regardless of whether you have created a project built entirely in non-BotCity frameworks.

How about trying out how it works for free?

Click here to create your free account and test these and other features. Join us in our community’s Slack and share your feedback and suggestions.