|
| 1 | +from selenium import webdriver |
| 2 | +import time |
| 3 | +browser = webdriver.Chrome('/home/arun/Downloads/chromedriver') |
| 4 | +browser.get('https://instagram.com/') |
| 5 | +time.sleep(4) #/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div/div[1]/div/label/input |
| 6 | +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") |
| 7 | +Username.send_keys("akpythonyt") |
| 8 | +time.sleep(4) |
| 9 | +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") |
| 10 | +password.send_keys("17mtcs01") |
| 11 | +password.submit() |
| 12 | +time.sleep(5) |
| 13 | +Notnow=browser.find_element_by_xpath("/html/body/div[1]/section/main/div/div/div/div/button") |
| 14 | +Notnow.click() #/html/body/div[1]/section/main/div/div/div/div/button |
| 15 | +time.sleep(3) |
| 16 | +Noti=browser.find_element_by_xpath("/html/body/div[4]/div/div/div/div[3]/button[2]") |
| 17 | +Noti.click() |
| 18 | +time.sleep(7) |
| 19 | + |
| 20 | +def firstpic(): |
| 21 | + time.sleep(5) |
| 22 | + pic = browser.find_element_by_class_name("_9AhH0") |
| 23 | + pic.click() |
| 24 | +def comment(): |
| 25 | + time.sleep(5) |
| 26 | + commentArea = browser.find_element_by_class_name('Ypffh') |
| 27 | + commentArea.click() |
| 28 | + time.sleep(5) |
| 29 | + commentArea = browser.find_element_by_class_name('Ypffh') |
| 30 | + commentArea.click() |
| 31 | + commentArea.send_keys("Test command") |
| 32 | + commentArea.submit() |
| 33 | + |
| 34 | +firstpic() |
| 35 | +comment() |
| 36 | + |
| 37 | + |
0 commit comments