Ubuntu 22 に Google Chrome For Testing 126 と chromedriver 126 をインストールしたメモです。
通常は、この手順を行うより、Docker の Standalone Chrome ( Selenium Grid )を使うのが楽でおすすめです。
https://hub.docker.com/r/selenium/standalone-chrome/tags
ただ、Docker が使えない環境下であったり、ファイルダウンロードについて特殊な要求がある場合等はうまくいかない場合があります。
dpkg --get-selections | grep google-chrome-stable
sudo dpkg --purge google-chrome-stable
下記ページを見る
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
cd /tmp
google-chrome --headless --disable-gpu --screenshot https://www.example.com/
imgcat screenshot.png
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}}
コメント