Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add install scripts #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions chromedriver-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
# download and install latest geckodriver for linux or mac.
# required for selenium to drive a firefox browser.

install_dir="/usr/local/bin"
version=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
if [[ $(uname) == "Darwin" ]]; then
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_mac64.zip
elif [[ $(uname) == "Linux" ]]; then
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_linux64.zip
else
echo "can't determine OS"
exit 1
fi
echo "url => $url"
curl -o chromedriver.zip "$url"
unzip chromedriver.zip
rm -f chromedriver.zip
chmod +x chromedriver
sudo mv chromedriver "$install_dir"
echo "installed chromedriver binary in $install_dir"
26 changes: 26 additions & 0 deletions geckodriver-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh
# download and install latest geckodriver for linux or mac.
# required for selenium to drive a firefox browser.

install_dir="/usr/local/bin"

# fetch latest version download url
json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
if [[ $(uname) == "Darwin" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("macos"))')
elif [[ $(uname) == "Linux" ]]; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64"))')
else
echo "can't determine OS"
exit 1
fi

# if you don't wanna use the latest version
# you can also comment out the section to get the latest version
# and set $url as tested version

# $url = https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz #set $url as tested version
sudo curl -s -L "$url" | tar -xz
sudo chmod +x geckodriver
sudo mv geckodriver "$install_dir"
echo "installed geckodriver binary in $install_dir"
13 changes: 13 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
sudo apt update
sudo apt install python3-pip curl jq -y
sudo pip3 install -r requirements.txt # install python3 dependency packages
# ===== Ubuntu 18.04 LTS need this =====
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py --force-reinstall
sudo rm get-pip.py # remove it after re-install
# ======================================

# fetch from https://gist.github.com/diemol/635f450672b5bf80420d595ca0016d20
#sudo bash geckodriver-install.sh
#sudo bash chromedriver-install.sh
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
selenium
requests