ラズパイで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
今回はpython3で導入(Debian 32bitの標準環境はpython2.7)
$ sudo apt install -y python3 python3-pip $ python3 -V Python 3.9.2
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
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
ラズパイと同じことをここでも
$ python3 selenium_by_geckodriver.py