Python

Python Modules for Automation Projects

Let’s see few Python modules used for writing automation scripts:

1. Selenium

These is the one of the most popular module of python through which we can control our browsers like “chrome”, “firefox”, etc.

Example - from selenium import webdriver
          driver = webdriver.Chrome()
          driver.get("https://www.resolvemyquery.com")

These is an example of these module you can make many interesting projects with selenium module.

2. PyAutoGui

These one is the also a most popular module to automate boring stuff. Through these module you can automate many boring stuffs with easily like typing, clicking on somewhere on the screen, etc.

Example - import pyautogui
          pyautogui.hotkey("alt","f4")
          pyautogui.press("enter")

These is an example these code shutdown your laptop's or pc's

3. OS

These is an inbuilt module of python, these module is can open or close any application, make folders, make files,etc.

Example -  os.system(“dir”)

These example of OS module give the list of folders. similar methods like os.remove(), os.rename(), os.close(), etc.

4. smtplib

These is an module through which you can automate boring stuffs like sending a email , login with gmail id,etc.

Example -
import smtplib
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login("sender_email_id", "sender_email_id_password")
message = "Message_you_need_to_send"
s.sendmail("sender_email_id", "receiver_email_id", message)
s.quit()

These is an example to send a email with smtplib module.

Leave a Comment