Use FireFox (via Homebrew-cask) with Selenium WebDriver Python bindings

When I tried to use FireFox with Selenium WebDriver (Python binding), I got the following error.

python


>>> from selenium import webdriver
>>> driver = webdriver.Firefox()
...
FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Firefox.app/Contents/MacOS/firefox-bin'

If you call webdriver.Firefox with no arguments, the default path for each environment will be used. (/Applications/Firefox.app/Contents/MacOS/firefox-bin for Mac)

(ref) https://github.com/SeleniumHQ/selenium/blob/master/py/selenium/webdriver/firefox/firefox_binary.py#L143

In my environment, I have installed FireFox via Homebrew-Cask, and the path in that case is ~ / Applications / Firefox.app/Contents/MacOS/firefox-bin. In order to tell WebDriver this path, you need to give a FireFoxBinary instance as follows.

python


>>> bin = webdriver.firefox.webdriver.FirefoxBinary('/Users/FGtatsuro/Applications/Firefox.app/Contents/MacOS/firefox')
>>> driver = webdriver.Firefox(firefox_binary=bin)

Recommended Posts

Use FireFox (via Homebrew-cask) with Selenium WebDriver Python bindings
Use selenium phantomjs webdriver with python unittest
Python: Working with Firefox with selenium
Selenium WebDriver + Firefox49 (provisional) (Python)
[Python] Use JSON with Python
Drive WebDriver with python
Use mecab with Python3
Use DynamoDB with Python
Use Python 3.8 with Anaconda
ScreenShot with Selenium (Python)
Use python with docker
Scraping with Selenium [Python]
Scraping with Selenium + Python Part 1
Use Twitter API with Python
Use TUN / TAP with Python
Scraping with Selenium in Python
Scraping with Selenium + Python Part 2
Use subsonic API with python3
Challenge Python3 and Selenium Webdriver
Python: How to use async with
Use vl53l0x with Raspberry Pi (python)
Scraping with Selenium in Python (Basic)
Scraping with Python, Selenium and Chromedriver
[Python] Use Basic/Digest authentication with Flask
Use NAIF SPICE TOOLKIT with Python
Use rospy with virtualenv in Python3
Use Python in pyenv with NeoVim
How to use FTP with Python
Use Windows 10 speech synthesis with Python
Use OpenCV with Python 3 in Window
Use PostgreSQL with Lambda (Python + psycopg2)
Operate Firefox with Selenium from python and save the screen capture
Send email via gmail with Python 3.4.3.
Get html from element with Python selenium
Use smbus with python3 under pyenv environment
Use DeepL with python (for dissertation translation)
WebUI test with Python2.6 + Selenium 2.44.0 --profile setting
Use Amazon Simple Notification Service with Python
[Python] Use string data with scikit-learn SVM
[Introduction to Python] Let's use foreach with Python
Use PIL and Pillow with Cygwin Python
Use cryptography library cryptography with Docker Python image
Use Application Insights with Python 3 (including bottles)
[Python] Automatically operate the browser with Selenium
Use C ++ functions from python with pybind11
Practice web scraping with Python and Selenium
Until you can use opencv with python
Use Python and MeCab with Azure Functions
Python + Selenium + Headless Chromium with aws lambda
Try out the touch of data-driven testing with Selenium Python Bindings and py.test
Freeze with send_keys of file selection when running Selenium WebDriver in Python [PhantomJS]
I want to use MATLAB feval with python
Use additional Python packages with Serverless Framework (v1.x)
Automatic operation of Chrome with Python + Selenium + pandas
Try running Google Chrome with Python and Selenium
Specify the Python executable to use with virtualenv
Use logger with Python for the time being
Python> Run with run-time arguments> Use import argparse
Use multiple versions of python environment with pyenv
Wrap C with Cython for use from Python
Log in to Yahoo Business with Selenium Python