Webブラウザを単一のAPIで自動化する「playwright」をインストールする

スポンサーリンク

Webブラウザを単一のAPIで自動化するライブラリである「playwright」ライブラリのインストールについて解説しています。

playwright(https://github.com/Microsoft/playwright-python)は、単一のAPIでChromium、Firefox、WebKitブラウザを自動化するためのライブラリです。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■playwrightをインストールする

playwrightをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install playwright

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.8 -m pip install playwright

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable
Collecting playwright
Downloading playwright-1.17.2-py3-none-win_amd64.whl (27.5 MB)
|████████████████████████████████| 27.5 MB 298 kB/s
Collecting pyee>=8.0.1
Downloading pyee-8.2.2-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: websockets>=8.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from playwright) (9.1)
Collecting greenlet>=1.0.0
Downloading greenlet-1.1.2-cp38-cp38-win_amd64.whl (101 kB)
|████████████████████████████████| 101 kB 2.1 MB/s
Requirement already satisfied: typing-extensions in c:\users\user_\appdata\roaming\python\python38\site-packages (from playwright) (3.7.4.3)
Installing collected packages: pyee, greenlet, playwright
Successfully installed greenlet-1.1.2 playwright-1.17.2 pyee-8.2.2

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、playwrightが正常にインストールされたことになります。

なお、今回はplaywrightのバージョン1.17.2をインストールしました。

コメント

タイトルとURLをコピーしました