File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+ from selenium import webdriver
3
+ import time
4
+ from selenium .webdriver .common .keys import Keys
5
+
6
+
7
+ dir = os .path .dirname (__file__ )
8
+ chrome_driver_path = dir + "\chromedriver.exe"
9
+
10
+ driver = webdriver .Chrome ("/Users/singhyogendra/Desktop/chromedriver" )
11
+ driver .implicitly_wait (5 )
12
+ driver .maximize_window ()
13
+
14
+ driver .get ("https://www.instagram.com/accounts/login/?source=auth_switcher" )
15
+ id = driver .find_element_by_xpath ("/html/body/div[1]/section/main/div/article/div/div[1]/div/form/div[2]/div/label/input" ).send_keys ("usernamme" )
16
+ password = driver .find_element_by_xpath ("/html/body/div[1]/section/main/div/article/div/div[1]/div/form/div[3]/div/label/input" ).send_keys ("password" )
17
+
18
+ driver .find_element_by_xpath ("/html/body/div[1]/section/main/div/article/div/div[1]/div/form/div[4]/button/div" ).click ()
19
+ time .sleep (1 )
20
+ driver .find_element_by_xpath ("/html/body/div[4]/div/div/div[3]/button[2]" ).click ()
21
+ time .sleep (3 )
22
+ driver .find_element_by_class_name ("_9AhH0" ).click ()
23
+ scroll = driver .find_element_by_xpath ("/html/body/div[1]/section/main/section/div[1]/div[1]/div/article[1]/div[1]/div/div/div[2]" )
24
+ y = 1100
25
+
26
+ for i in range (1 , 20 ):
27
+ i = str (i )
28
+ time .sleep (2 )
29
+ driver .execute_script ("arguments[0].click();" , driver .find_element_by_xpath ("/html/body/div[1]/section/main/section/div[1]/div[1]/div/article[" + i + "]/div[2]/section[1]/span[1]/button" ))
30
+ driver .execute_script ("window.scrollTo(0, " + str (y ) + ")" )
31
+ y += 1100
32
+ time .sleep (1 )
33
+
You can’t perform that action at this time.
0 commit comments