| 12345678910111213141516171819202122232425262728293031323334353637 |
- sudo apt-get update
- sudo apt-get install wget curl unzip python3 python3-pip xvfb -y
- cd `dirname $0`
- if [[ ! `dpkg -l | grep chrome` ]]
- then
- echo 'install google-chrome'
- deb_url='https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
- wget $deb_url -O –
- sudo dpkg -i –
- rm -f –
- fi
- echo 'download chromedriver...'
- chrome_version=`google-chrome --version | awk -F '[ .]' '/^Google Chrome [0-9]+(.[0-9])*/ {print $3}'`
- if [[ ! $chrome_version ]]
- then
- echo 'google-chrome not found'
- exit 1
- fi
- [[ ! -d driver ]] && mkdir driver
- if [[ -f driver/chromedriver ]]
- then
- driver_version=`driver/chromedriver --version | awk -F '[ .]' '/^ChromeDriver [0-9]+(.[0-9])* */ {print $2}'`
- fi
- if [[ $chrome_version -ne $driver_version ]]
- then
- driver_version_url=https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$chrome_version
- driver_version=`curl $driver_version_url`
- driver_url=https://chromedriver.storage.googleapis.com/$driver_version/chromedriver_linux64.zip
- wget -O chromedriver_linux64.zip $driver_url
- unzip -d driver -o chromedriver_linux64.zip
- rm -f chromedriver_linux64.zip
- fi
- echo 'install python requirements...'
- pip3 install -r requirements.txt
|