Skip to content

Instantly share code, notes, and snippets.

@Erotemic
Created July 9, 2015 20:32
Show Gist options
  • Save Erotemic/ea5b68dd2e28cc3a592d to your computer and use it in GitHub Desktop.
Save Erotemic/ea5b68dd2e28cc3a592d to your computer and use it in GitHub Desktop.
Example of failing to login with tomcat
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
cp ~/Downloads/wildbook-5.3.0-RELEASE.war .
# 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/wildbook-5.3.0-RELEASE
# Run selenium script to login
exec 42<<'__PYSCRIPT__'
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/wildbook-5.3.0-RELEASE')
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()
__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