Build a web bot in 2 minutes 🤖

There is a ton of repetitive tasks that we can automate thanks to bots, in this article I’ll show you the easiest and the fastest way to build a bot using Python and Selenium 🚀🚀🚀.

Chrome web driver makes it possible to manage the browser using any programming language, here we will use Python.

  • First, download the webDriver here.
  • Second, unzip the chromedriver.zip file and copy the webDriver to a specified location: cp chromeDriver /Library/webdrivers/chromeDriver
  • Third, add the location of the webDriver to the PATH env variable :
export PATH="$PATH:/Library/webdrivers/"
pip install selenium
a simple use case for the bot

To execute the Python code and run the bot use the following command:

python simple-selenium-bot.py

The usage of the sleep()method is very common in these types of bots, it allows you to wait for a request to be sent or for the UI to be refreshed before continuing the execution of the program.

Screen recording of the bot

This is a simple bot program that shows you how Selenium works, there is a lot of real-world use cases out there to implement in order to gain time or productivity using Selenium, here are some bot ideas I worked on previously :

  • Checking the availability in a booking system.
  • Checking out the availability of a high demanding article in a marketplace.
  • End-to-end tests of a web application.
  • ….

That’s it, if you find this article interesting don’t hesitate to let me a comment or hit the 👏 button below.

Lead Software Engineer working across multiple technologies and frameworks. Always willing to challenge my problem solving skills.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store