Advertisement
funcelot

start_java_server.sh

Feb 2nd, 2020
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.66 KB | None | 0 0
  1. #!/bin/bash -e
  2. echo https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/
  3.  
  4. export CLASSPATH=".:selenium-server-standalone-3.13.0.jar:testng-6.8.7.jar"
  5.  
  6. cmd="xvfb-run --auto-servernum --server-num=1 java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone-3.13.0.jar"
  7.  
  8. #runs command in the backgorund
  9. $cmd &
  10.  
  11. #waits until server is ready to process requests and returns control
  12. until curl -sSf http://localhost:4444 > /dev/null 2>&1; do :; done
  13.  
  14. javac TecAdminSeleniumTest.java
  15. java TecAdminSeleniumTest
  16.  
  17. sleep 1
  18. bg_pid=$!
  19.  
  20. #terminates a background task by pid
  21. selenium_pid=$(lsof -i:4444 -t)
  22. kill $selenium_pid
  23. wait $bg_pid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement