Creating a Automation bot with python

Creating a Automation bot with python

Automation is a powerful tool and can be used to finish your tasks faster.

Automation

Automation has become very important and a is really a powerful tool in recent days. There are mainly two programming languages used for automation, python and Java Script. Each language has its own famous libraries for automating web tasks.

Libraries

The major library used for automating is Selenium. It is very powerful and is used by many companies for checking of web applications. The famous libraries in java script is Puppeteer

Requirements

We need to have the following for web automation in python,

The libraries can be installed with the pip packet manager. We can also use a web scraping library like Beautiful Soup with automation to perform variety of tasks (explained in the project section).

Concept of Web Automation

Web Development depends on creating many tags such as input ,h1,code. Similarly Web automation works by finding where this tags are present on our webpage by looking at the source code of the web page. Then perform actions on the tag or get information from the tag. Web automation also provides Driver wait functions for hidden links.

Project

Creating a Web Bot which is used to answer multiple choice assignment questions by getting answers from another website by scraping content from the website. This project can be divided into two parts scraping for answers and answering multiple choice questions with the answers.

Scraping for answers

The library beautifulsoup4 is used for to get the answers from other website and store it in a list.

Answering the questions

First, login is performed by sending the username and password to the input fields and pressing the log in button automatically. Then, after opening chrome, we must need to proceed to page where the multiple choice questions are present. This is done by finding buttons to next page and clicking on them. Then the options to a question are collected and are compared with the answers to the question scraped from the website in step 1. If the option is found right, the radio button is clicked. Then answering every question, finally the submit button is clicked.

The complete project and work flow of the project can be found on Github. If you want a tutorial on the whole project please comment below.

Did you find this article valuable?

Support hari's blog by becoming a sponsor. Any amount is appreciated!