Created
July 10, 2015 13:39
-
-
Save Erotemic/1778cf59d69f67971689 to your computer and use it in GitHub Desktop.
Fresh Wildbook Login Script
This file contains 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
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 | |
cd $CODE_DIR/Wildbook/ | |
# Clean up old tomcat | |
rm -rf apache-tomcat-8.0.24 | |
# --- FRESHSTART --- | |
# Download and unzip tomcat | |
utzget http://www.gtlib.gatech.edu/pub/apache/tomcat/tomcat-8/v8.0.24/bin/apache-tomcat-8.0.24.zip | |
# Make sure that tomcat vars are set | |
export TOMCAT_DIR=$CODE_DIR/Wildbook/apache-tomcat-8.0.24 | |
export TOMCAT_HOME=$TOMCAT_DIR | |
export CATALINA_HOME=$TOMCAT_DIR | |
# SEEMS LIKE THIS SHOULD NOT BE REMOVED. # Not sure if this is what is supposed to be removeed | |
#rm $TOMCAT_DIR/lib/websocket-api.jar | |
# make catalina runnable | |
chmod +x $CATALINA_HOME/bin/catalina.sh | |
chmod +x $CATALINA_HOME/bin/startup.sh | |
chmod +x $CATALINA_HOME/bin/shutdown.sh | |
# Install a wildbook .war file into tomcat webapps | |
cd $CATALINA_HOME/webapps | |
#wget http://dev.wildme.org/fluke/images/ibeis.war | |
#export WB_TARGET=wildbook-5.3.0-RELEASE | |
export WB_TARGET=ibeis | |
cp ~/Downloads/$WB_TARGET.war $CATALINA_HOME/webapps/ | |
# RUN TOMCAT SERVER | |
$CATALINA_HOME/bin/startup.sh | |
# Open wildbook in browser | |
sleep .5 | |
#google-chrome --new-window http://localhost:8080 | |
#google-chrome --new-tab http://localhost:8080/$WB_TARGET | |
# Run selenium script to login | |
exec 42<<'__PYSCRIPT__' | |
# STARTBLOCK | |
import utool as ut | |
import os | |
chromedriver = ut.grab_selenium_chromedriver() | |
os.environ['webdriver.chrome.driver'] = chromedriver | |
from selenium import webdriver | |
driver = webdriver.Chrome() | |
driver.get('http://localhost:8080/' + os.environ['WB_TARGET']) | |
login_button = driver.find_element_by_partial_link_text('Log in') | |
login_button.click() | |
username_field = driver.find_element_by_name('username') | |
password_field = driver.find_element_by_name('password') | |
username_field.send_keys('tomcat') | |
password_field.send_keys('tomcat123') | |
submit_login_button = driver.find_element_by_name('submit') | |
submit_login_button.click() | |
# ENDBLOCK | |
__PYSCRIPT__ | |
python /dev/fd/42 $@ | |
# View logs | |
gvim $CATALINA_HOME/logs/catalina.out | |
# CLOSE TOMCAT SERVER | |
$CATALINA_HOME/bin/shutdown.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment