0
0

Python Selenium [ docker: no matching manifest for linux/arm64/v8 in the manifest list entries. ] の解決方法

Last updated at Posted at 2024-07-24

背景

Raspberry Pi を使って Selenium を実行しようとしたところ、エラーが出たので解決策を残しておきます。

今回解決できたエラー

  • docker: no matching manifest for linux/arm64/v8 in the manifest list entries.

解決策

結論から言うと、使おうとしたDockerイメージがアーキテクチャにあってないから出たエラーでした。
なので、アーキテクチャにあったイメージを使えば解決できました。

Docker run

docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" seleniarm/standalone-chromium:latest

このイメージを使うことで正常に動くはずです。

Python code

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Remote(
    command_executor = "http://192.168.0.***:4444/wd/hub",
    options = webdriver.ChromeOptions()
)

url = "https://www.hoge/any-url"

driver.implicitly_wait(10)

driver.get(url)

class_elm = driver.find_element(By.CLASS_NAME, "class_name")

time.sleep(5)

print(class_elm)

driver.quit()

最後に

seleniumの基本的な使い方は下記が参考になりました。

参考になれば幸いです。

動的スクレイピング遅すぎる...

0
0
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
0
0