LoginSignup
1
3

More than 3 years have passed since last update.

ubuntu20.04でheadlessなfirefoxをseleniumからたたいてみる

Posted at

参考にしたサイト

もろもろのダウンロードとインストール

#sudo apt-install python3-pip firefox-geckodriver -y
#sudo pip3 install selenium

Firefox起動まで。

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.binary_location = '/usr/bin/firefox'
options.add_argument('-headless')
driver = webdriver.Firefox(options=options)
#あとは参考サイトと同じソースで動きます。

メモ

geckodriverとは、Webdriverからfirefoxを使うためのwapperみたいなものらしい。

1
3
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
1
3