Selenium + ChromeDriverインストール - Ubuntu18.04

Java他インストール

 apt-get install -y unzip xvfb libxi6 libgconf-2-4
 apt-get install default-jdk 

Google Chromeインストール

 curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
 echo "deb [arch=amd64]  http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
 apt-get -y update
 apt-get -y install google-chrome-stable

Chromeドライバインストール

 dpkg -l | grep -i chrome
 cd /home/selenium/src
 wget https://chromedriver.storage.googleapis.com/76.0.3809.126/chromedriver_linux64.zip
 unzip chromedriver_linux64.zip
 mv chromedriver /usr/local/bin/
 chmod 755 /usr/local/bin/chromedriver

Selenium Serverインストール

 wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar 
 cp selenium-server-standalone-3.141.59.jar /home/selenium/selenium-server-standalone.jar
 java -jar selenium-server-standalone.jar

(ブラウザ) http://localhost:4444/

Selenium Server実行

 xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /home/selenium/selenium-server-standalone.jar

PHPインストール

 add-apt-repository ppa:ondrej/php
 apt update
 apt show php7.3
 apt install php7.3 php7.3-common php7.3-cli php7.3-fpm php7.3-mysql php7.3-dev php7.3-mbstring php7.3-zip php7.3-curl
 curl -sS https://getcomposer.org/installer | php
 mv composer.phar /usr/local/bin/composer
 chmod 755 /usr/local/bin/composer

php-webdriverインストール

 composer require facebook/webdriver

参考

https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2019-08-26 (月) 09:42:17