LoginSignup
3

More than 5 years have passed since last update.

Selenium + Firefox 47+ の Can't load the profile. のエラーの対応

Last updated at Posted at 2016-11-01
python
from selenium.webdriver import Firefox
driver = Firefox()
driver.get('http://example.com')

した時に、

Can't load the profile. というエラーが出る対応。mac。

Firefox 47 から入ってるマリオネット marionette という環境構成システム(?) に、Selenium が対応できていない?

geckodriver を brew でインストールする。

command
$ brew install geckodriver
$ pip install -U selenium
python
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True

driver = webdriver.Firefox(capabilities=firefox_capabilities)
driver.get('http://example.com')

これでOK

参考: Can't open browser with Selenium after Firefox update - Stack Overflow

追記

その後、

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x109a96690>> ignored

これが出たら

python
import os
if "/usr/local/bin" not in os.environ['PATH']:
    os.environ['PATH'] += os.pathsep + "/usr/local/bin"

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
3