MacでSelenium

準備:色々とインストール

# Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Chorome driver
brew install chromedriver

# java
brew tap AdoptOpenJDK/openjdk
brew install --cask adoptopenjdk12
# check java installation
java -version

# download selenium
curl -OL https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
mv selenium-server-standalone-3.141.59.jar /Applications/

seleniumの実行と

# run selenium
java -jar /Applications/selenium-server-standalone-3.141.59.jar
# ちょっとまっていると色々と表示される

# check process id
ps -A | grep 'java'
  # 12708 ttys000  0:00.20 /usr/bin/java -jar /Applications/selenium-server-standalone-3.141.59.jar
  # 12802 ttys000  0:00.00 grep java

# stop selenium
# 数字は1行目の左端に表示されるprocess idを入力
kill 12708