32bit LinuxでSelenium

ラズパイでSeleniumが動作したので気を良くして32bit Linuxで試してみた。

セットアップの準備

$ sudo apt update
$ sudo apt upgrade

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
$ uname -a
Linux debian 5.10.0-10-686-pae #1 SMP Debian 5.10.84-1 (2021-12-08) i686 GNU/Linux

python環境

今回はpython3で導入(Debian 32bitの標準環境はpython2.7)

$ sudo apt install -y python3 python3-pip
$ python3 -V
Python 3.9.2

selenium の導入

selenium の導入(バージョン指定をせずに導入すると selenium 4 なのは周知の事実)

$ pip3 install selenium

ここでエラーが発生。 build-essential は導入済みだったが Rust が必要らしい。

$ sudo apt install curl
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer

Welcome to Rust!

== 途中省略 ==

Current installation options:


   default host triple: i686-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>

== 途中省略 ==

Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source $HOME/.cargo/env

そのまま[リターン]で i686-unknown-linux-gnu を選択。
実は、openssl も必要ということで

$ sudo apt install -y libssl-dev

さっきの selenium 導入失敗時に upgrade しろって言われたみたいだから

$ pip install --upgrade pip

ようやく仕切り直しで

$ pip3 install selenium
$ pip3 list | grep selenium
selenium         4.1.0

geckodriver の導入

chromium-chromedriver が導入できないようなので、代わりに geckodriver の導入。
まずは、Firefox ESR の導入。

$ sudo apt install firefox-esr-l10n-ja
$ firefox --version
Mozilla Firefox 91.6.0esr

geckodriver の導入は手作業。

$ wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux32.tar.gz
$ tar -zxvf geckodriver-v0.30.0-linux32.tar.gz

$ sudo mv geckodriver /usr/bin/geckodriver
$ sudo chown root:root /usr/bin/geckodriver
$ sudo chmod +x /usr/bin/geckodriver

ソースコード(selenium_by_geckodriver.py)

ラズパイと同じことをここでも

実行

$ python3 selenium_by_geckodriver.py

添付ファイル: fileselenium_by_geckodriver.py 283件 [詳細]

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-02-15 (火) 15:04:52