LoginSignup
3
8

More than 3 years have passed since last update.

Python×Seleniumで自動化するための環境構築

Last updated at Posted at 2019-05-25

環境構築(Mac用)

Mac OSにはデフォルトでPythonがインストールされているため、そこはスキップ。

Homebrewのインストール

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

確認コマンド

brew doctor

chrome-driverのインストール

brew cask install chromedriver

pipのインストール

pipとは?
pipはPythonのパッケージを管理するためのツールになる。
パッケージには、『公式が配布しているもの』『サードパーティが配布しているもの』と大きく分けて2つがある。
サードパーティのパッケージはPyPIというサイトで配布されている。
引用元:PyPl https://pypi.org/

# pipがインストールされているかを確認
python -m pip -V

インストールされていない場合、get-pip.pyを下記のURLよりダウンロードして、pythonから実行する。
https://bootstrap.pypa.io/get-pip.py

python get-pip.py

ChromeDriver のインストール

ChromeDriverとは?
Pythonのプログラム上でChromeを利用することができるようにするためのDriver。

#  installされていないことを確認
pip list

# install実行
pip install chromedriver-binary

#  installされたことを確認
pip list

selennium のインストール

selenniumとは?
Webアプリケーションのテスト自動化を実現するブラウザ駆動型テストツール群です。Webブラウザの自動操作ライブラリとしてさまざまな機能を備えています。

#  installされていないことを確認
pip list

# install実行
pip install selenium

#  installされたことを確認
pip list

これで自動化するための環境づくりはできるはず。
あとは、Pythonのプログラム書いてどんどん自動化していきまっしょい!

3
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
8