Skip to content

AttributeError: 'Options' object has no attribute 'binary' #4643

@WhosMyName

Description

@WhosMyName

Meta -

OS:

$uname -a
Linux archdeekus 4.11.3-1-ARCH #1 SMP PREEMPT Sun May 28 10:40:17 CEST 2017 x86_64 GNU/Linux

Selenium Version:

$pip3 show selenium
Name: selenium
Version: 3.4.3
Summary: Python bindings for Selenium
Home-page: https://github.com/SeleniumHQ/selenium/
Author: UNKNOWN
Author-email: UNKNOWN
License: Apache 2.0
Location: /usr/lib/python3.6/site-packages
Requires:

Browser:

$firefox -v
Mozilla Firefox 55.0.3

Browser Version:

55.0.3(64-bit)

Expected Behavior - Instance of Firefox starting

Actual Behavior - Error thrown:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "ProxLoadMe.py", line 186, in retrieve_source
    switcher = parse_file(hoster, name, currthreads, iterator)
  File "ProxLoadMe.py", line 197, in parse_file
    driver = init_webdriver()
  File "ProxLoadMe.py", line 51, in init_webdriver
    return webdriver.Firefox(firefox_options=options, log_path="geckodriver.log")
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 118, in __init__
    if firefox_options.binary is not None:
AttributeError: 'Options' object has no attribute 'binary'

Steps to reproduce -

def init_webdriver():
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    options = Options()
    options.binary_location = "/usr/bin/firefox"
    options.add_argument("-headless")
    return webdriver.Firefox(firefox_options=options, log_path="geckodriver.log")

driver = init_webdriver()
driver.close()

Using options.binary = "/usr/bin/firefox" following error appears:

Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "ProxLoadMe.py", line 186, in retrieve_source
    switcher = parse_file(hoster, name, currthreads, iterator)
  File "ProxLoadMe.py", line 197, in parse_file
    driver = init_webdriver()
  File "ProxLoadMe.py", line 51, in init_webdriver
    return webdriver.Firefox(firefox_options=options, log_path="geckodriver.log")
  File "/usr/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 120, in __init__
    if firefox_options.profile is not None:
AttributeError: 'Options' object has no attribute 'profile'

/usr/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py references to /usr/lib/python3.6/site-packages/selenium/webdriver/firefox/options.py, which contains:

def __init__(self):
        self._binary = None
        self._preferences = {}
        self._profile = None
        self._proxy = None
        self._arguments = []
        self.log = Log()

Calling webdriver.Firefox(log_path="geckodriver.log") simply opens Firefox.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions