python automation training

As we are aware Python is used for automating many small and monotonous tasks. Python is simple language, straightforward to find out, browse and code. 

Example, if you wish to alter piece of writing text files that is simple, as Python contains a ton of string libraries already. If you wish to alter task of Moving files and renaming them, there is related library which will automate your task. 

For Eg. We can Automate Facebook Login using python script. We can use selenium webdriver to control the browser. 

Please find below process, code and explanation from Livewire trainer Mr.Siddhesh Upkare.

From selenium import webdriver

From getpass import getpass

ur = input(‘Enter your FB username’)

pd = getpass(‘Enter your password: ‘)

driver = webdriver.Chrome()

driver.get(‘https://www.facebook.com/’)  comment {This is page url we want to automate}

username_box = driver.find_element_by_id(’email’) comment {To get id from the username field by right clicking on it and selecting inspection} username_box.send_keys(usr) comment{ It will send username to webpage.}

password_box = driver.find_element_by_id(‘pass’)      // to get id from the password field by right clicking on it and selecting inspection password_box.send_keys(pwd) //{It will send username to webpage}

login_btn = driver.find_element_by_id(‘u_0_2’) // {To get id from the password field right clicking on it and selecting inspection}

login_btn.submit()// {To locate the login button}

The getpass function works like a normal function except it doesn’t display input on the screen making it more secure to just input normally. 

This is how one can use Python Programming to automate any repetitive tasks.