文書の過去の版を表示しています。
Selenium
本家: SeleniumHQ Browser Automation
ドキュメント: Seleniumブラウザー自動化プロジェクト :: Seleniumドキュメント
ソースコード: GitHub - SeleniumHQ/selenium: A browser automation framework and ecosystem.
Selenium は、 Webアプリケーションをテストするためのポータブルフレームワークである。 Selenium は、テストスクリプト言語(Selenium IDE)を学ぶ必要なしに、機能テストを作成するための再生ツールを提供する。また、C#、Groovy、Java、Perl、PHP、Python、Ruby、Scala 等の一般的なプログラミング言語でテストを作成するためのテストドメイン固有言語(Selenese)も提供する。その後、テストはほとんどの最新のWebブラウザに対して実行できる。Selenium は、Windows、Linux、およびmacOSで動作する。これは、Apache License 2.0 の下でリリースされたオープンソースソフトウェアである。
Selenium (ソフトウェア) - Wikipedia より
ChromeDriver のインストール
Linux
$ sudo dnf install chromedriver
メタデータの期限切れの最終確認: 2:47:02 時間前の 2020年05月07日 10時05分24秒 に実施しました。 依存関係が解決しました。 ==================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================== インストール: chromedriver x86_64 80.0.3987.163-1.fc31 updates 519 k 依存関係のインストール: alsa-lib x86_64 1.2.2-2.fc31 updates 472 k cdparanoia-libs x86_64 10.2-30.fc31 fedora 55 k chromium-common x86_64 80.0.3987.163-1.fc31 updates 9.7 M chromium-libs x86_64 80.0.3987.163-1.fc31 updates 81 M chromium-libs-media x86_64 80.0.3987.163-1.fc31 updates 2.3 M flac-libs x86_64 1.3.3-1.fc31 fedora 223 k gstreamer1 x86_64 1.16.2-1.fc31 updates 1.3 M gstreamer1-plugins-base x86_64 1.16.2-2.fc31 updates 2.0 M iso-codes noarch 4.3-2.fc31 fedora 3.3 M libXScrnSaver x86_64 1.2.3-4.fc31 fedora 25 k libXv x86_64 1.0.11-10.fc31 fedora 18 k libogg x86_64 2:1.3.3-3.fc31 fedora 26 k libtheora x86_64 1:1.1.1-24.fc31 fedora 187 k libvisual x86_64 1:0.4.0-27.fc31 fedora 149 k libvorbis x86_64 1:1.3.6-5.fc31 fedora 201 k minizip-compat x86_64 1.2.11-20.fc31 updates 32 k opus x86_64 1.3.1-2.fc31 fedora 218 k orc x86_64 0.4.30-1.fc31 fedora 181 k pipewire-libs x86_64 0.2.7-2.fc31 updates 318 k rtkit x86_64 0.11-22.fc31 fedora 58 k sbc x86_64 1.4-3.fc31 fedora 64 k xml-common noarch 0.6.3-53.fc31 fedora 31 k 弱い依存関係のインストール: pipewire x86_64 0.2.7-2.fc31 updates 146 k トランザクションの概要 ===================================================================================================================== インストール 24 パッケージ ダウンロードサイズの合計: 102 M インストール済みのサイズ: 455 M これでよろしいですか? [y/N]: y パッケージのダウンロード: (1/24): alsa-lib-1.2.2-2.fc31.x86_64.rpm 2.2 MB/s | 472 kB 00:00 (2/24): chromedriver-80.0.3987.163-1.fc31.x86_64.rpm 857 kB/s | 519 kB 00:00 (3/24): chromium-libs-media-80.0.3987.163-1.fc31.x86_64.rpm 3.5 MB/s | 2.3 MB 00:00 (4/24): gstreamer1-1.16.2-1.fc31.x86_64.rpm 2.9 MB/s | 1.3 MB 00:00 (5/24): gstreamer1-plugins-base-1.16.2-2.fc31.x86_64.rpm 3.4 MB/s | 2.0 MB 00:00 (6/24): minizip-compat-1.2.11-20.fc31.x86_64.rpm 326 kB/s | 32 kB 00:00 (7/24): chromium-common-80.0.3987.163-1.fc31.x86_64.rpm 3.8 MB/s | 9.7 MB 00:02 (8/24): pipewire-0.2.7-2.fc31.x86_64.rpm 1.0 MB/s | 146 kB 00:00 (9/24): pipewire-libs-0.2.7-2.fc31.x86_64.rpm 2.5 MB/s | 318 kB 00:00 (10/24): cdparanoia-libs-10.2-30.fc31.x86_64.rpm 387 kB/s | 55 kB 00:00 (11/24): flac-libs-1.3.3-1.fc31.x86_64.rpm 1.0 MB/s | 223 kB 00:00 (12/24): libXScrnSaver-1.2.3-4.fc31.x86_64.rpm 275 kB/s | 25 kB 00:00 (13/24): libXv-1.0.11-10.fc31.x86_64.rpm 368 kB/s | 18 kB 00:00 (14/24): libogg-1.3.3-3.fc31.x86_64.rpm 502 kB/s | 26 kB 00:00 (15/24): libtheora-1.1.1-24.fc31.x86_64.rpm 1.6 MB/s | 187 kB 00:00 (16/24): libvisual-0.4.0-27.fc31.x86_64.rpm 1.5 MB/s | 149 kB 00:00 (17/24): libvorbis-1.3.6-5.fc31.x86_64.rpm 2.2 MB/s | 201 kB 00:00 (18/24): opus-1.3.1-2.fc31.x86_64.rpm 1.4 MB/s | 218 kB 00:00 (19/24): iso-codes-4.3-2.fc31.noarch.rpm 3.9 MB/s | 3.3 MB 00:00 (20/24): orc-0.4.30-1.fc31.x86_64.rpm 1.8 MB/s | 181 kB 00:00 (21/24): rtkit-0.11-22.fc31.x86_64.rpm 660 kB/s | 58 kB 00:00 (22/24): sbc-1.4-3.fc31.x86_64.rpm 593 kB/s | 64 kB 00:00 (23/24): xml-common-0.6.3-53.fc31.noarch.rpm 265 kB/s | 31 kB 00:00 (24/24): chromium-libs-80.0.3987.163-1.fc31.x86_64.rpm 7.2 MB/s | 81 MB 00:11 -------------------------------------------------------------------------------------------------------------------- 合計 8.1 MB/s | 102 MB 00:12 トランザクションの確認を実行中 トランザクションの確認に成功しました。 トランザクションのテストを実行中 トランザクションのテストに成功しました。 トランザクションを実行中 準備 : 1/1 インストール中 : libogg-2:1.3.3-3.fc31.x86_64 1/24 インストール中 : alsa-lib-1.2.2-2.fc31.x86_64 2/24 インストール中 : minizip-compat-1.2.11-20.fc31.x86_64 3/24 インストール中 : gstreamer1-1.16.2-1.fc31.x86_64 4/24 インストール中 : chromium-common-80.0.3987.163-1.fc31.x86_64 5/24 インストール中 : flac-libs-1.3.3-1.fc31.x86_64 6/24 インストール中 : libtheora-1:1.1.1-24.fc31.x86_64 7/24 インストール中 : libvorbis-1:1.3.6-5.fc31.x86_64 8/24 scriptletの実行中: xml-common-0.6.3-53.fc31.noarch 9/24 インストール中 : xml-common-0.6.3-53.fc31.noarch 9/24 インストール中 : iso-codes-4.3-2.fc31.noarch 10/24 インストール中 : sbc-1.4-3.fc31.x86_64 11/24 scriptletの実行中: rtkit-0.11-22.fc31.x86_64 12/24 インストール中 : rtkit-0.11-22.fc31.x86_64 12/24 scriptletの実行中: rtkit-0.11-22.fc31.x86_64 12/24 Created symlink /etc/systemd/system/graphical.target.wants/rtkit-daemon.service → /usr/lib/systemd/system/rtkit-daemon.service. インストール中 : orc-0.4.30-1.fc31.x86_64 13/24 インストール中 : opus-1.3.1-2.fc31.x86_64 14/24 インストール中 : libvisual-1:0.4.0-27.fc31.x86_64 15/24 インストール中 : libXv-1.0.11-10.fc31.x86_64 16/24 インストール中 : libXScrnSaver-1.2.3-4.fc31.x86_64 17/24 インストール中 : cdparanoia-libs-10.2-30.fc31.x86_64 18/24 インストール中 : gstreamer1-plugins-base-1.16.2-2.fc31.x86_64 19/24 scriptletの実行中: pipewire-0.2.7-2.fc31.x86_64 20/24 インストール中 : pipewire-0.2.7-2.fc31.x86_64 20/24 インストール中 : pipewire-libs-0.2.7-2.fc31.x86_64 21/24 インストール中 : chromium-libs-media-80.0.3987.163-1.fc31.x86_64 22/24 インストール中 : chromium-libs-80.0.3987.163-1.fc31.x86_64 23/24 インストール中 : chromedriver-80.0.3987.163-1.fc31.x86_64 24/24 scriptletの実行中: chromium-libs-media-80.0.3987.163-1.fc31.x86_64 24/24 scriptletの実行中: chromedriver-80.0.3987.163-1.fc31.x86_64 24/24 検証 : alsa-lib-1.2.2-2.fc31.x86_64 1/24 検証 : chromedriver-80.0.3987.163-1.fc31.x86_64 2/24 検証 : chromium-common-80.0.3987.163-1.fc31.x86_64 3/24 検証 : chromium-libs-80.0.3987.163-1.fc31.x86_64 4/24 検証 : chromium-libs-media-80.0.3987.163-1.fc31.x86_64 5/24 検証 : gstreamer1-1.16.2-1.fc31.x86_64 6/24 検証 : gstreamer1-plugins-base-1.16.2-2.fc31.x86_64 7/24 検証 : minizip-compat-1.2.11-20.fc31.x86_64 8/24 検証 : pipewire-0.2.7-2.fc31.x86_64 9/24 検証 : pipewire-libs-0.2.7-2.fc31.x86_64 10/24 検証 : cdparanoia-libs-10.2-30.fc31.x86_64 11/24 検証 : flac-libs-1.3.3-1.fc31.x86_64 12/24 検証 : iso-codes-4.3-2.fc31.noarch 13/24 検証 : libXScrnSaver-1.2.3-4.fc31.x86_64 14/24 検証 : libXv-1.0.11-10.fc31.x86_64 15/24 検証 : libogg-2:1.3.3-3.fc31.x86_64 16/24 検証 : libtheora-1:1.1.1-24.fc31.x86_64 17/24 検証 : libvisual-1:0.4.0-27.fc31.x86_64 18/24 検証 : libvorbis-1:1.3.6-5.fc31.x86_64 19/24 検証 : opus-1.3.1-2.fc31.x86_64 20/24 検証 : orc-0.4.30-1.fc31.x86_64 21/24 検証 : rtkit-0.11-22.fc31.x86_64 22/24 検証 : sbc-1.4-3.fc31.x86_64 23/24 検証 : xml-common-0.6.3-53.fc31.noarch 24/24 インストール済み: alsa-lib-1.2.2-2.fc31.x86_64 cdparanoia-libs-10.2-30.fc31.x86_64 chromedriver-80.0.3987.163-1.fc31.x86_64 chromium-common-80.0.3987.163-1.fc31.x86_64 chromium-libs-80.0.3987.163-1.fc31.x86_64 chromium-libs-media-80.0.3987.163-1.fc31.x86_64 flac-libs-1.3.3-1.fc31.x86_64 gstreamer1-1.16.2-1.fc31.x86_64 gstreamer1-plugins-base-1.16.2-2.fc31.x86_64 iso-codes-4.3-2.fc31.noarch libXScrnSaver-1.2.3-4.fc31.x86_64 libXv-1.0.11-10.fc31.x86_64 libogg-2:1.3.3-3.fc31.x86_64 libtheora-1:1.1.1-24.fc31.x86_64 libvisual-1:0.4.0-27.fc31.x86_64 libvorbis-1:1.3.6-5.fc31.x86_64 minizip-compat-1.2.11-20.fc31.x86_64 opus-1.3.1-2.fc31.x86_64 orc-0.4.30-1.fc31.x86_64 pipewire-0.2.7-2.fc31.x86_64 pipewire-libs-0.2.7-2.fc31.x86_64 rtkit-0.11-22.fc31.x86_64 sbc-1.4-3.fc31.x86_64 xml-common-0.6.3-53.fc31.noarch 完了しました!
動作確認
$ chromedriver --version
ChromeDriver 100.0.4896.127 (ff0d0695743e65305d7194f9bd309e5e1c824aa0-refs/branch-heads/4896_88@{#4})
$ chromedriver --help
Usage: chromedriver [OPTIONS] Options --port=PORT port to listen on --adb-port=PORT adb server port --log-path=FILE write server log to file instead of stderr, increases log level to INFO --log-level=LEVEL set log level: ALL, DEBUG, INFO, WARNING, SEVERE, OFF --verbose log verbosely (equivalent to --log-level=ALL) --silent log nothing (equivalent to --log-level=OFF) --append-log append log file instead of rewriting --replayable (experimental) log verbosely and don't truncate long strings so that the log can be replayed. --version print the version number and exit --url-base base URL path prefix for commands, e.g. wd/url --readable-timestamp add readable timestamps to log --enable-chrome-logs show logs from the browser (overrides other logging options) --disable-dev-shm-usage do not use /dev/shm (add this switch if seeing errors related to shared memory) --allowed-ips=LIST comma-separated allowlist of remote IP addresses which are allowed to connect to ChromeDriver --allowed-origins=LIST comma-separated allowlist of request origins which are allowed to connect to ChromeDriver. Using `*` to allow any host origin is dangerous!
Windows
Scoop によるインストール。
$ scoop install chromedriver
Installing 'chromedriver' (102.0.5005.61) [64bit] chromedriver_win32.zip (6.1 MB) [=============================================================================] 100% Checking hash of chromedriver_win32.zip ... ok. Extracting chromedriver_win32.zip ... done. Linking ~\scoop\apps\chromedriver\current => ~\scoop\apps\chromedriver\102.0.5005.61 Creating shim for 'chromedriver'. 'chromedriver' (102.0.5005.61) was installed successfully!
動作確認
$ chromedriver --version
ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819})
$ chromedriver --help
Usage: C:\Users\tomoyan\scoop\apps\chromedriver\current\chromedriver.exe [OPTIONS] Options --port=PORT port to listen on --adb-port=PORT adb server port --log-path=FILE write server log to file instead of stderr, increases log level to INFO --log-level=LEVEL set log level: ALL, DEBUG, INFO, WARNING, SEVERE, OFF --verbose log verbosely (equivalent to --log-level=ALL) --silent log nothing (equivalent to --log-level=OFF) --append-log append log file instead of rewriting --replayable (experimental) log verbosely and don't truncate long strings so that the log can be replayed. --version print the version number and exit --url-base base URL path prefix for commands, e.g. wd/url --readable-timestamp add readable timestamps to log --enable-chrome-logs show logs from the browser (overrides other logging options) --allowed-ips=LIST comma-separated allowlist of remote IP addresses which are allowed to connect to ChromeDriver --allowed-origins=LIST comma-separated allowlist of request origins which are allowed to connect to ChromeDriver. Using `*` to allow any host origin is dangerous!
Selenium のインストール
$ pip install selenium
Collecting selenium Downloading selenium-3.141.0-py2.py3-none-any.whl (904 kB) |████████████████████████████████| 904 kB 1.1 MB/s Collecting urllib3 Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB) |████████████████████████████████| 127 kB 3.3 MB/s Installing collected packages: urllib3, selenium Successfully installed selenium-3.141.0 urllib3-1.25.10