from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
web=webdriver.Chrome("D:\chromedriver")
web.get("https://www.amazon.com")
searchbox=web.find_element_by_id("twotabsearchtextbox")
searchbox.send_keys("macbook pro")
time.sleep(1)
Find=web.find_element_by_xpath("/html/body/div[1]/header/div/div[1]/div[2]/div/form/div[3]/div/span/input")
Find.click()
time.sleep(1)
import time
from selenium.webdriver.common.keys import Keys
web=webdriver.Chrome("D:\chromedriver")
web.get("https://www.amazon.com")
searchbox=web.find_element_by_id("twotabsearchtextbox")
searchbox.send_keys("macbook pro")
time.sleep(1)
Find=web.find_element_by_xpath("/html/body/div[1]/header/div/div[1]/div[2]/div/form/div[3]/div/span/input")
Find.click()
time.sleep(1)
Update: Hello Coders , We have one github repository.And I uploaded some of the projects that I taught in youtube.So check out our github account to grab additional knowledge in python
from selenium import webdriver
import time
browser=webdriver.Chrome("D:\chromedriver.exe")
browser.get("https://www.instagram.com/")
time.sleep(4)
#Login
Username=browser.find_element_by_xpath("/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[1]/div/label/input")
Username.send_keys("Username")
time.sleep(4)
Password=browser.find_element_by_xpath("/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[2]/div/label/input")
Password.send_keys("Password")
Password.submit()
time.sleep(5)
#NotNow
Notnow=browser.find_element_by_xpath("/html/body/div[1]/section/main/div/div/div/div/button")
Notnow.click()
time.sleep(3)
#Notification
Noti=browser.find_element_by_xpath("/html/body/div[4]/div/div/div/div[3]/button[2]")
Noti.click()
time.sleep(3)
#Logic
def firstpic():
time.sleep(2)
pic=browser.find_element_by_class_name("_9AhH0")
pic.click()
def likepic():
time.sleep(3)
like=browser.find_element_by_xpath("/html/body/div[1]/section/main/section/div/div[2]/div/article[1]/div[3]/section[1]/span[1]/button")
like.click()
firstpic()
likepic()
import time
browser=webdriver.Chrome("D:\chromedriver.exe")
browser.get("https://www.instagram.com/")
time.sleep(4)
#Login
Username=browser.find_element_by_xpath("/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[1]/div/label/input")
Username.send_keys("Username")
time.sleep(4)
Password=browser.find_element_by_xpath("/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[2]/div/label/input")
Password.send_keys("Password")
Password.submit()
time.sleep(5)
#NotNow
Notnow=browser.find_element_by_xpath("/html/body/div[1]/section/main/div/div/div/div/button")
Notnow.click()
time.sleep(3)
#Notification
Noti=browser.find_element_by_xpath("/html/body/div[4]/div/div/div/div[3]/button[2]")
Noti.click()
time.sleep(3)
#Logic
def firstpic():
time.sleep(2)
pic=browser.find_element_by_class_name("_9AhH0")
pic.click()
def likepic():
time.sleep(3)
like=browser.find_element_by_xpath("/html/body/div[1]/section/main/section/div/div[2]/div/article[1]/div[3]/section[1]/span[1]/button")
like.click()
firstpic()
likepic()
from fpdf import FPDF
pdf=FPDF()
# Add a Page
pdf.add_page()
pdf.set_font("Arial",size=25)
pdf.cell(200,10,txt="Hello this is ak",ln=1,align="C")
pdf.output("Path of your PDF output File..!")
pdf=FPDF()
# Add a Page
pdf.add_page()
pdf.set_font("Arial",size=25)
pdf.cell(200,10,txt="Hello this is ak",ln=1,align="C")
pdf.output("Path of your PDF output File..!")
from selenium import webdriver
from time import sleep
driver = webdriver.Chrome("/home/arun/Downloads/chromedriver")
driver.get("Google maps website")
sleep(2)
def searchplace():
Place=driver.find_element_by_class_name("tactile-searchbox-input")
Place.send_keys("Tiruchirappalli")
Submit=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[3]/div[1]/div[1]/div[1]/div[2]/div[1]/button")
Submit.click()
searchplace()
def directions():
sleep(10)
directions=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[1]/div/button")
directions.click()
directions()
def find():
sleep(6)
find=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[3]/div[1]/div[2]/div/div[3]/div[1]/div[1]/div[2]/div/div/input")
find.send_keys("Tirunelveli")
sleep(2)
search=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[3]/div[1]/div[2]/div/div[3]/div[1]/div[1]/div[2]/button[1]")
search.click()
find()
def kilometers():
sleep(5)
Totalkilometers=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[1]/div[1]/div[1]/div[1]/div[2]/div")
print("Total Kilometers:",Totalkilometers.text)
sleep(5)
Bus=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[1]/div[1]/div[1]/div[1]/div[1]/span[1]")
print("Bus Travel:",Bus.text)
sleep(7)
Train=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[2]/div[1]/div[2]/div[1]/div")
print("Train Travel:",Train.text)
sleep(7)
kilometers()
def available():
print("*COVID-19 Special Trains*")
sleep(7)
trainone=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[2]/div[1]/div[2]/div[2]/span/span[2]/span[1]/span[1]/span")
print("Train No:1",trainone.text)
def availableone():
trainsec=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[2]/div[1]/div[2]/div[2]/span/span[8]/span[1]/span[1]/span")
print("Train No:2",trainsec.text)
available()
availableone()
from time import sleep
driver = webdriver.Chrome("/home/arun/Downloads/chromedriver")
driver.get("Google maps website")
sleep(2)
def searchplace():
Place=driver.find_element_by_class_name("tactile-searchbox-input")
Place.send_keys("Tiruchirappalli")
Submit=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[3]/div[1]/div[1]/div[1]/div[2]/div[1]/button")
Submit.click()
searchplace()
def directions():
sleep(10)
directions=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[1]/div/button")
directions.click()
directions()
def find():
sleep(6)
find=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[3]/div[1]/div[2]/div/div[3]/div[1]/div[1]/div[2]/div/div/input")
find.send_keys("Tirunelveli")
sleep(2)
search=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[3]/div[1]/div[2]/div/div[3]/div[1]/div[1]/div[2]/button[1]")
search.click()
find()
def kilometers():
sleep(5)
Totalkilometers=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[1]/div[1]/div[1]/div[1]/div[2]/div")
print("Total Kilometers:",Totalkilometers.text)
sleep(5)
Bus=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[1]/div[1]/div[1]/div[1]/div[1]/span[1]")
print("Bus Travel:",Bus.text)
sleep(7)
Train=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[2]/div[1]/div[2]/div[1]/div")
print("Train Travel:",Train.text)
sleep(7)
kilometers()
def available():
print("*COVID-19 Special Trains*")
sleep(7)
trainone=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[2]/div[1]/div[2]/div[2]/span/span[2]/span[1]/span[1]/span")
print("Train No:1",trainone.text)
def availableone():
trainsec=driver.find_element_by_xpath("/html/body/jsl/div[3]/div[9]/div[7]/div/div[1]/div/div/div[5]/div[2]/div[1]/div[2]/div[2]/span/span[8]/span[1]/span[1]/span")
print("Train No:2",trainsec.text)
available()
availableone()