├── README.md ├── IP to Location └── IpToLocation.py ├── Selecting from Drop Down └── SelectingFromDropDown.py ├── Google Search └── GoogleSearch.py ├── Scraping Example └── Simple Scraping.py ├── Gmail Unread Mails └── unreadmails.py ├── Facebook Login └── FB_login.py ├── Facebook AutoPokeBack └── pokeback.py ├── AutoMated UI test └── uitest.py ├── Whatsapp Web └── whatsappweb.py ├── Send Email from Gmail └── email.py ├── Github Star Generator └── GithubAutomaticStarGenerator.py └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # Browser Automation in Python Using Selenium 2 | ## Download Selenium in Python 3 | ### Using pip 4 | ```xml 5 | pip install selenium 6 | ``` 7 | 8 | ## Running the Code 9 | 1. Download or clone the repository 10 | 2. Open seach script in Python Idle (Version 3.0+) 11 | 3. Run them. 12 | 4. Some of the scripts require your own password to operate. 13 | -------------------------------------------------------------------------------- /IP to Location/IpToLocation.py: -------------------------------------------------------------------------------- 1 | #Python 2.7 2 | import json 3 | from urllib import urlopen 4 | 5 | ip_info = urlopen('http://freegeoip.net/json/').read() 6 | 7 | my_ip = json.loads(ip_info) 8 | 9 | print "Approx Loaction is:- \n\tLatitude : %f \n\tLongitude : %f \n\tCountry: %s" % ( 10 | my_ip.get('latitude'), my_ip.get('longitude'), my_ip.get('country_name')) 11 | -------------------------------------------------------------------------------- /Selecting from Drop Down/SelectingFromDropDown.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | driver = webdriver.Firefox() 3 | driver.get("http://www.goibibo.com/") 4 | ele = driver.find_element_by_xpath("//*[@id='gi_class']") 5 | all_options = ele.find_elements_by_tag_name("option") 6 | for option in all_options: 7 | #printing all options text vlaues 8 | print (option.text) 9 | #selecting First Class 10 | if option.text == 'First Class': 11 | option.click() 12 | -------------------------------------------------------------------------------- /Google Search/GoogleSearch.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities 4 | 5 | driver = webdriver.Chrome("D:\chromedriver\chromedriver") 6 | driver.get("http://www.google.com") 7 | if not "Google" in driver.title: 8 | raise Exception("Unable to load google page!") 9 | 10 | elem = driver.find_element_by_name("q") 11 | elem.send_keys("selenium") 12 | elem.submit() 13 | 14 | print (driver.title) 15 | driver.quit() 16 | -------------------------------------------------------------------------------- /Scraping Example/Simple Scraping.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.support.ui import WebDriverWait 3 | 4 | 5 | def print_dish_names(): 6 | driver = webdriver.Chrome("D:\chromedriver\chromedriver") 7 | driver.implicitly_wait(10) 8 | driver.get("https://zipongo.com/recipes/category/fruits") 9 | driver.implicitly_wait(10) 10 | dishes=driver.find_elements_by_css_selector('.js-name') 11 | times=driver.find_elements_by_css_selector('.small-8') 12 | dictionary={} 13 | j=0 14 | for i in dishes: 15 | dictionary[i.text]=int(times[j].text.split(' ')[2]) 16 | j+=2 17 | for key in sorted(dictionary, key=dictionary.get, reverse=False): 18 | print (key, dictionary[key]) 19 | driver.close() 20 | 21 | if __name__ == "__main__": 22 | print_dish_names() 23 | -------------------------------------------------------------------------------- /Gmail Unread Mails/unreadmails.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | 4 | import re 5 | 6 | driver = webdriver.Chrome("D:\chromedriver\chromedriver") 7 | driver.get("http://www.gmail.com") 8 | driver.implicitly_wait(5) 9 | driver.find_element_by_xpath("//*[@id='Email']").send_keys("dynamitechetan@gmail.com") 10 | driver.find_element_by_id("next").click() 11 | driver.find_element_by_xpath("//*[@id='Passwd']").send_keys("password") 12 | driver.find_element_by_xpath("//*[@id='signIn']").click() 13 | inbox = driver.find_element_by_xpath("//*[contains(@title,'Inbox')]").text 14 | 15 | pattern = re.compile("\w+\s+\((\d+)\)") 16 | match = re.search(pattern,inbox) 17 | if match: 18 | print("Total no of unread mails in your inbox are ",int(match.group(1))) 19 | 20 | driver.close() 21 | -------------------------------------------------------------------------------- /Facebook Login/FB_login.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | 4 | usr = "yourUsername" 5 | pwd = "passwordHere" 6 | 7 | driver = webdriver.Firefox() 8 | # or you can use Chrome(executable_path="/usr/bin/chromedriver") 9 | driver.get("http://www.facebook.org") 10 | assert "Facebook" in driver.title 11 | elem = driver.find_element_by_id("email") 12 | elem.send_keys(usr) 13 | elem = driver.find_element_by_id("pass") 14 | elem.send_keys(pwd) 15 | elem.send_keys(Keys.RETURN) 16 | 17 | #elem = driver.find_element_by_xpath("/html/body/div[1]/div[1]/div/div[1]/div/div/div/div[2]/div[2]/div[2]/div/a/div") 18 | #elem.click() 19 | #elem = driver.find_element_by_class_name("seeMore") 20 | #elem.click() 21 | #elem = driver.find_element_by_class_name("_1rt") 22 | 23 | 24 | #elem = driver.find_element_by_xpath("/html/body/div[1]/div[1]/div/div[1]/div/div/div/div[2]/div[2]/div[2]/div/div/div[3]/div/div[1]/div/div/ul/li[2]/a/div/div[2]/div/div[2]/div/div[1]/strong/span") 25 | #elem.click() 26 | 27 | #send_keys("Hi") 28 | -------------------------------------------------------------------------------- /Facebook AutoPokeBack/pokeback.py: -------------------------------------------------------------------------------- 1 | import time 2 | from selenium import webdriver 3 | from selenium.webdriver.common.keys import Keys 4 | import getpass 5 | 6 | print "Enter your email ID" 7 | email_id = raw_input(">>") 8 | print "Enter your password" 9 | #password = raw_input(">>") 10 | password = getpass.getpass(">>") 11 | 12 | driver = webdriver.Firefox() 13 | driver.get("https://www.facebook.com/pokes") 14 | driver.maximize_window() 15 | 16 | email = driver.find_element_by_xpath("//label[@for = 'email']") 17 | email.send_keys(email_id) 18 | driver.find_element_by_xpath("//label[@for = 'pass']").click() 19 | passwd = driver.find_element_by_xpath("//label[@for = 'pass']") 20 | passwd.send_keys(password) 21 | passwd.send_keys(Keys.ENTER) 22 | 23 | 24 | pokes = driver.find_elements_by_link_text('Poke Back') 25 | for poke in pokes: 26 | poke.click() 27 | 28 | driver.find_element_by_id('userNavigationLabel').click() 29 | 30 | time.sleep(1) 31 | 32 | logout = driver.find_element_by_class_name('_w0d') 33 | logout.submit() 34 | 35 | 36 | driver.implicitly_wait(2) 37 | driver.close() 38 | -------------------------------------------------------------------------------- /AutoMated UI test/uitest.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from selenium import webdriver 3 | from selenium.webdriver.common.keys import Keys 4 | 5 | class ChalkpadLogin(unittest.TestCase): 6 | 7 | def setUp(self): 8 | self.driver =webdriver.Chrome("D:\chromedriver\chromedriver") 9 | 10 | def test_login(self): 11 | driver = self.driver 12 | 13 | usr = "rollNumberPleaseReplace" 14 | pwd = "PASSWORD" 15 | driver = webdriver.Chrome("D:\chromedriver\chromedriver") 16 | # or you can use Chrome(executable_path="/usr/bin/chromedriver") 17 | driver.get("http://punjab.chitkara.edu.in//Interface/index.php") 18 | assert "Chalkpad" in driver.title 19 | elem = driver.find_element_by_id("username") 20 | elem.send_keys(usr) 21 | elem = driver.find_element_by_id("password") 22 | elem.send_keys(pwd) 23 | elem.send_keys(Keys.RETURN) 24 | self.assertTrue(driver.find_element_by_link_text("Logout"),"Logout link") 25 | 26 | def tearDown(self): 27 | self.driver.close() 28 | 29 | if __name__ == "__main__": 30 | unittest.main() 31 | -------------------------------------------------------------------------------- /Whatsapp Web/whatsappweb.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | import time, os 4 | 5 | driver = None 6 | 7 | def wait(web_opening_time=3): 8 | time.sleep(web_opening_time) 9 | 10 | def web_driver_load(): 11 | global driver 12 | ddriver = webdriver.Chrome("D:\chromedriver\chromedriver") 13 | 14 | def web_driver_quit(): 15 | driver.quit() 16 | 17 | def whatsapp_login(): 18 | driver.get('https://web.whatsapp.com/'); 19 | wait(10) 20 | 21 | 22 | def sendMessage(msg, recepient_list): 23 | for recep in recepient_list: 24 | print ("Sending to : ",recep) 25 | try: 26 | one_chat = driver.find_element_by_xpath("//span[@title='%s']"%(recep)) 27 | except: 28 | print ("Unable to find username [%s]"%recep) 29 | continue 30 | if one_chat != None: 31 | try: 32 | one_chat.click() 33 | wait(1) 34 | print ("Chatbox opened for ", recep) 35 | text_box = driver.find_element_by_xpath("//div[@contenteditable='true']") 36 | for letter in list(msg): 37 | text_box.send_keys(letter) 38 | wait(0.1) 39 | text_box.send_keys(Keys.RETURN) 40 | except: 41 | print ("Unable to send msg [%s] to [%s]"%(msg, recep)) 42 | continue 43 | print ("Message [%s] sent to [%s]"%(msg, recep)) 44 | 45 | if __name__ == '__main__': 46 | number_of_times = 1 47 | messages = ["""Hello"""] 48 | recepients = ["Testing"] 49 | 50 | web_driver_load() 51 | whatsapp_login() 52 | 53 | for i in range(number_of_times): 54 | for msg in messages: 55 | print ("[%d]"%(i+1)) 56 | sendMessage(msg, recepients) 57 | web_driver_quit() 58 | -------------------------------------------------------------------------------- /Send Email from Gmail/email.py: -------------------------------------------------------------------------------- 1 | import time 2 | import sys 3 | from selenium import webdriver 4 | from selenium.webdriver.common.keys import Keys 5 | from selenium.webdriver.common.by import By 6 | from selenium.webdriver.support.ui import WebDriverWait 7 | from selenium.webdriver.support import expected_conditions as EC 8 | 9 | browser= webdriver.Chrome() 10 | browser.get("https://mail.google.com") 11 | 12 | emailid= browser.find_element_by_id('Email') 13 | emailid.send_keys('Your Email ID') 14 | 15 | nextButton= browser.find_element_by_id('next') 16 | nextButton.click() 17 | 18 | password = WebDriverWait(browser, 10).until( 19 | EC.presence_of_element_located((By.ID, 'Passwd'))) 20 | password.send_keys('YourPassword') 21 | 22 | signInButton = browser.find_element_by_id('signIn') 23 | signInButton.click() 24 | 25 | Composeemail= WebDriverWait(browser,10).until( 26 | EC.presence_of_element_located((By.XPATH, "//div[text()='COMPOSE']"))) 27 | Composeemail.click() 28 | 29 | mailto = browser.find_element_by_name("to") 30 | mailto.send_keys('Enter Recipient Email ID') 31 | 32 | entersubject= WebDriverWait(browser,10) 33 | entersubject= browser.find_element_by_name("subjectbox") 34 | entersubject.send_keys('Auto mail test with Selenium') 35 | 36 | mailBody = browser.find_element_by_css_selector("div[aria-label='Message Body']") 37 | mailBody.send_keys('This is an auto generated email. Please Ignore.') 38 | time.sleep(5) 39 | 40 | sendmail = WebDriverWait(browser,10) 41 | sendmail = browser.find_element_by_xpath("//div[text()='Send']") 42 | sendmail.click() 43 | 44 | logout1 = WebDriverWait(browser,10) 45 | logout1 = browser.find_element_by_class_name('gbii') 46 | logout1.click() 47 | 48 | logout2 = browser.find_element_by_id("gb_71") 49 | logout2.click() 50 | 51 | time.sleep(3) -------------------------------------------------------------------------------- /Github Star Generator/GithubAutomaticStarGenerator.py: -------------------------------------------------------------------------------- 1 | import time 2 | import random 3 | from selenium import webdriver 4 | import pyautogui 5 | from selenium.webdriver.common.keys import Keys 6 | 7 | 8 | for x in range(387,8000000): 9 | 10 | i=random.randint(0,148); 11 | 12 | names=["Nestor-Ohair", "Misty-Meiser", "Nyla-Hockman", "Evalyn-Aoki", "Michal-Mincks", "Maryalice-Railey", "Aubrey-Spengler", "Slyvia-Lucarelli", "Deedee-Bergquist", "Nu-Landrith", "Marilynn-Hansell", "Janelle-Seaberg", "Georgianne-Gott", "Shannan-Ota", "Raelene-Epperly", "Gabriela-Hodges", "Mathew-Samet", "Norah-Gin", "Toshia-Bergevin", "Mitsuko-Edmund", "Izola-Osmun", "Tonette-Vital", "Gwyneth-Blanchard", "Lashonda-Theriot", "Kecia-Alfrey", "Numbers-Tritt", "Lynsey-Bate", "Palmira-Aberle", "Jolynn-Gonyea", "Dino-Bulloch", "Lilliana-Pinkham", "Alyssa-Tice", "Thi-Rickards", "Diedra-Wiltsie", "Jayme-Haus", "Lazaro-Nicks", "Maybell-Perry", "Kandi-Weary", "Maryann-Schrom", "Rashad-Petrucci", "Chauncey-Silvis", "Flo-Eldredge", "Cora-Eber", "Lavelle-Medlen", "Lanelle-Blecha", "Genna-Holcomb", "Tyisha-Asmus", "Eleonora-Iverson", "Coleen-Daquila", "Craig-Beckmann", "Sindy", "Mireille", "Alesha", "Galina", "Corliss", "Towanda", "Abbie", "Katia", "German", "Carina", "Sherly", "Danica", "Ken", "Desmond", "Lekisha", "Elnora", "Lenita", "Douglas", "Billye", "Rocio", "Elvin", "Kenia", "Candida", "Jaye", "Katrina", "Marcel", "Tania", "Kesha", "Brook", "Regena", "Sylvie", "Jae", "Wai", "Madeline", "Adelia", "Savanna", "Jacquiline", "Lottie", "Tamekia", "Paulina", "Blake", "Christi", "Ina", "Jung", "Corinna", "Sophia", "Vanetta", "Marya", "Eloy", "Isobel","Angeline-Fry", "Marianne-Richman", "Ladonna-Mozingo", "Lenard-Pelfrey", "Twyla-Stanforth", "Danielle-Pedretti", "Vennie-Hippert", "Jaleesa-Kinghorn", "Benton-Thrailkill", "Cheri-Soja", "Patti-Loose", "Nakita-Sipe", "Particia-Bober", "Sherry-Beutler", "Kristal-Nez", "Garrett-Galicia", "Toya-Rodriguez", "Rochell-Lajoie", "Li-Violet", "Roberto-Teachout", "Antoine-Bertin", "Amiee-Prestwood", "Dina-Ransdell", "Stephnie-Gift", "Inge-Mayne", "Leonor-Earnest", "Shon-Clary", "Ping-Simmons", "Belia-Keatts", "Malisa-Schank", "Noelia-Collazo", "Maya-Bellini", "Mathew-Benedetto", "Nella-Rainer", "Shad-Cullum", "Kathey-Littlewood", "Carrie-Feiler", "Suzy-Shuler", "Graciela-Podesta", "Thomas-Chavers", "Tonia-Woodland", "Jadwiga-Schreckengost", "Cherrie-Geiser", "Asia-Getman", "Lucilla-Troester", "Gianna-Mcgillis", "Allegra-Carasco", "Marcella-Hintzen", "Grady-Hixson", "Douglass-Kolb"]; 13 | 14 | driver = webdriver.Chrome() 15 | 16 | driver.get("https://github.com/join?source=header-home"); 17 | 18 | # driver.find_element_by_class_name("octicon-star").click(); 19 | 20 | # driver.find_element_by_xpath("//*[@id='login']/p/a").click(); 21 | 22 | user = driver.find_element_by_id("user_login"); 23 | user.send_keys(names[i] + str(x)); 24 | email = driver.find_element_by_id("user_email"); 25 | email.send_keys(names[i] + str(x) + "@maildrop.cc"); 26 | passw = driver.find_element_by_id("user_password"); 27 | passw.send_keys(names[i]+"@123"); 28 | passw.send_keys(Keys.RETURN) 29 | driver.find_element_by_xpath("//*[@id='js-pjax-container']/div/div[2]/div/form/button").click(); 30 | 31 | driver.find_element_by_xpath("//*[@id='js-pjax-container']/div/div[2]/div/form/a").click(); 32 | 33 | time.sleep(10); 34 | driver.get("http://maildrop.cc/inbox/" + names[i] + str(x)); 35 | driver.find_element_by_xpath("//*[@id='inboxtbl']/tbody/tr[1]/td[2]/a").click(); 36 | time.sleep(10); 37 | pyautogui.press('tab'); 38 | # time.sleep(1); 39 | pyautogui.press('tab'); 40 | # time.sleep(1); 41 | pyautogui.press('tab'); 42 | # time.sleep(1); 43 | pyautogui.press('tab'); 44 | # time.sleep(1); 45 | pyautogui.press('tab'); 46 | time.sleep(1); 47 | 48 | pyautogui.keyDown('ctrl'); 49 | time.sleep(1); 50 | # driver.find_element_by_xpath("/html/body/div[2]/div/a").click(); 51 | pyautogui.press('enter'); 52 | pyautogui.keyUp('ctrl'); 53 | time.sleep(10); 54 | 55 | # pyautogui.keyDown('ctrl'); 56 | # time.sleep(1); 57 | # driver.find_element_by_xpath("/html/body/div[2]/div/a").click(); 58 | # pyautogui.press('w'); 59 | # pyautogui.keyUp('ctrl'); 60 | 61 | # driver.find_element_by_xpath("//*[@id='js-pjax-container']/div[1]/div/div/a[2]").click(); 62 | 63 | # repo=driver.find_element_by_id("repository_name"); 64 | # repo.send_keys(names[i]); 65 | # repo.send_keys(Keys.RETURN); 66 | 67 | driver.get("https://github.com/AnupKumarPanwar"); 68 | driver.find_element_by_xpath("//*[@id='js-pjax-container']/div/div/div[2]/div[1]/div/span/span[1]/form/button"); 69 | 70 | 71 | driver.get("https://github.com/AnupKumarPanwar/Ionic-FB-Login-PHP-MySQL-DB-AdMob"); 72 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 73 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 74 | 75 | 76 | driver.get("https://github.com/AnupKumarPanwar/Book-it-to-the-Moon"); 77 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 78 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 79 | 80 | 81 | driver.get("https://github.com/AnupKumarPanwar/Browser-Automation"); 82 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 83 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 84 | 85 | 86 | 87 | 88 | 89 | driver.get("https://github.com/AnupKumarPanwar/MoonData"); 90 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 91 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 92 | 93 | 94 | driver.get("https://github.com/TheAlgorithms/C-Plus-Plus/stargazers"); 95 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 96 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 97 | 98 | 99 | driver.get("https://github.com/TheAlgorithms/Scala/stargazers"); 100 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 101 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 102 | 103 | 104 | 105 | driver.get("https://github.com/TheAlgorithms/Python/stargazers"); 106 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 107 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 108 | 109 | 110 | driver.get("https://github.com/dynamitechetan/Project0_Portfolio_App_Udacity"); 111 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 112 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 113 | 114 | 115 | driver.get("https://github.com/AnupKumarPanwar/Algorithms"); 116 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 117 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 118 | 119 | 120 | driver.get("https://github.com/dynamitechetan/Browser-Automation"); 121 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 122 | 123 | driver.get("https://github.com/AnupKumarPanwar/Ionic-Google-Maps-App-to-Locate-Friends"); 124 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 125 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 126 | 127 | driver.get("https://github.com/AnupKumarPanwar/FireBase-Chat-App"); 128 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 129 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 130 | 131 | 132 | driver.get("https://github.com/AnupKumarPanwar/NodeJS-SocketIO-Realtime-Chat-App"); 133 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[3]/a[1]").click(); 134 | driver.find_element_by_xpath("//*[@id='js-repo-pjax-container']/div[1]/div[1]/ul/li[2]/div/form[2]/button").click(); 135 | 136 | # driver.find_element_by_xpath("//*[@id='user-links']/li[3]/div/div/form/button").click(); 137 | 138 | driver.quit(); 139 | 140 | with open("users.txt", "a") as myfile: 141 | myfile.write(names[i]+str(x) + "\", \"" ); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------