Ubuntu Linux に Google Chrome For Testing とchromedriver をインストールする

Linux
2024-06-13 12:09 (4ヶ月前) ytyng
View in English

Ubuntu 22 に Google Chrome For Testing 126 と chromedriver 126 をインストールしたメモです。

補足

通常は、この手順を行うより、Docker の Standalone Chrome ( Selenium Grid )を使うのが楽でおすすめです。

https://hub.docker.com/r/selenium/standalone-chrome/tags

ただ、Docker が使えない環境下であったり、ファイルダウンロードについて特殊な要求がある場合等はうまくいかない場合があります。

手順

apt で google-chrome-stable がインストールされていたらアンインストールする。

dpkg --get-selections | grep google-chrome-stable

sudo dpkg --purge google-chrome-stable

chrome for testing のリリース状況を確認する

下記ページを見る

https://googlechromelabs.github.io/chrome-for-testing/

ダウンロード

Linux で

cd /tmp
curl -O "https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.55/linux64/chrome-linux64.zip"
curl -O "https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.55/linux64/chromedriver-linux64.zip"

展開

unzip chrome-linux64.zip
unzip chromedriver-linux64.zip

-d オプションは無くて大丈夫

移動

sudo mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin/
sudo mv /tmp/chrome-linux64 /usr/local/bin/
sudo ln -s /usr/local/bin/chrome-linux64/chrome /usr/local/bin/google-chrome

Chrome 動作確認

cd /tmp
google-chrome --headless --disable-gpu --screenshot https://www.example.com/
imgcat screenshot.png

chromedriver 動作確認

chromedriver --verbsose & curl -d '{ "desiredCapabilities": {"browserName": "chrome", "chromeOptions": {"args": [ "--headless" ]} }}' http://127.0.0.1:9515/session

結果

Starting ChromeDriver 126.0.6478.55 (7616ff175414646cbd1ac65e912fc530b19cc573-refs/branch-heads/6478@{#1402}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
{"sessionId":"463314578b16e8b2d57efc572a6fa6b8","status":0,"value":{"acceptInsecureCerts":false,"acceptSslCerts":false,"browserConnectionEnabled":false,"browserName":"chrome-headless-shell","chrome":{"chromedriverVersion":"126.0.6478.55 (7616ff175414646cbd1ac65e912fc530b19cc573-refs/branch-heads/6478@{#1402})","userDataDir":"/tmp/.org.chromium.Chromium.RjvIex"},"cssSelectorsEnabled":true,"databaseEnabled":false,"fedcm:accounts":true,"goog:chromeOptions":{"debuggerAddress":"localhost:34017"},"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Linux","proxy":{},"rotatable":false,"setWindowRect":true,"strictFileInteractability":false,"takesHeapSnapshot":true,"takesScreenshot":true,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unexpectedAlertBehaviour":"ignore","version":"126.0.6478.55","webStorageEnabled":true,"webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:extension:minPinLength":true,"webauthn:extension:prf":true,"webauthn:virtualAuthenticators":true}}
現在未評価
タイトルとURLをコピー

コメント

アーカイブ

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011