How to automate web browser activity : Putting username and password in forms.

Lately i was experimenting with different automation libraries in python and found this interesting library called selenium which can do a lot of amazing stuffs.

 

Below is the code in python , using selenium library to automate stuff.

Here in the code i have automated login to academia.srmuniv.ac.in .

import time
from selenium import webdriver
driver = webdriver.Chrome();
driver.get(“https://academia.srmuniv.ac.in/”)
driver.implicitly_wait(10)

iframe = driver.find_elements_by_css_selector(‘iframe’)[0]
driver.switch_to.frame(iframe)

iframe2 = driver.find_elements_by_css_selector(‘iframe’)[0]
driver.switch_to.frame(iframe2)

#Use of two iframe objects is because the form containing input field is inside an iframe which is inside an iframe

username = driver.find_element_by_id(“Email”)
username.send_keys(“You username”)
password = driver.find_element_by_id(“Password”)
password.send_keys(“Your password”)

Modify the code with you own credentials and wow look your code can do things you do daily yourself .

Cheers ! Next post on automating feedback forms filling coming up.

Click here to visit our youtube channel –> CHANNEL

#like #comment #share

Click here to visit our Facebook Page SECTOR443

Thankyou

Regards

Stay Safe Stay Secure | Sector443

#sector443.com

 

Leave a Reply

Your email address will not be published. Required fields are marked *