Created
December 2, 2015 15:58
-
-
Save TApicella/f68d67796528f286adf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" This script bulk uploads emoji to a slack channel """ | |
import os, time | |
from pyvirtualdisplay import Display | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
rootdir = 'EMOJI SOURCE' | |
display = Display(visible=0, size=(800, 600)) | |
display.start() | |
count = 0 | |
for subdir, dirs, files in os.walk(rootdir): | |
for f in files: | |
count = count+1 | |
print count | |
if count > 0: #Change this value if this program crashes and you need to start from the middle | |
print f | |
splitname = f.split('.') | |
lowername = splitname[0].lower() | |
print lowername | |
driver = webdriver.Chrome("DRIVER LOCATION") | |
driver.get("https://yourteam.slack.com/customize/emoji") | |
login_input = driver.find_element_by_name("email") | |
login_input.send_keys("[email protected]") | |
pwd_input = driver.find_element_by_name("password") | |
time.sleep(1) | |
pwd_input.send_keys("yourpassword") | |
pwd_input.send_keys(Keys.RETURN) | |
emojiname = driver.find_element_by_name("name") | |
emojiname.send_keys(lowername) | |
emojiimg = driver.find_element_by_name("img") | |
emojiimg.send_keys(rootdir+file) | |
time.sleep(1) | |
emojiname.send_keys(Keys.RETURN) | |
driver.close() | |
display.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment