forked from horberlan/Selenium-github-webdriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Follow_users.py
44 lines (34 loc) · 1.05 KB
/
Follow_users.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import sys
import time
driver = webdriver.Chrome()
driver.get('https://github.com/login')
# enter with Login'
username = driver.find_element_by_id('login_field')
password = driver.find_element_by_id('password')
# values login
username.send_keys("user_name")
time.sleep(1)
password.send_keys("password")
time.sleep(1)
# login button
press_login = driver.find_element_by_xpath("//input[@value='Sign in']")
time.sleep(1)
press_login.click()
time.sleep(1)
listname = 'Soldy','horberlan', '...' # Add as many usernames as you want.
for name in listname:
for page in range(1, 80):
url = 'https://github.com/search?p={}&q={}&type=Users'.format(page, name)
driver.get(url)
time.sleep(1)
# press button
follow_user = driver.find_elements_by_xpath("//input[@aria-label='Follow this person']")
try:
for i in follow_user:
i.submit()
except:
pass
time.sleep(1)
driver.close()