Hey Khushi, writing test scripts in Selenium with Python is almost similar to writing scripts in Java, except for the syntax. Below is a code snippet of test Script written in Python testing the Login functionality of Facebook:
'''
Created on 09-May-2019
@author: Anvi_R
'''
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome("C:\\\\Users\\\\Abha_Rathour\\\\Downloads\\\\ExtractedFiles\\\\chromedriver_win32\\\\chromedriver.exe")
driver.maximize_window()
driver.implicitly_wait(3)
driver.get("http://www.facebook.com")
assert "Facebook" in driver.title
driver.find_element_by_id("email").send_keys("username")
driver.find_element_by_id("pass").send_keys("password")
driver.find_element_by_id("u_0_8").click()
driver.close()
Here, I have used driver.implicitly_wait(time_in_seconds) to let the driver load all the web elements, so that elements can be located easily.