Skip to content

Commit

Permalink
Use the correct binary path when using Marionette
Browse files Browse the repository at this point in the history
  • Loading branch information
davehunt committed Jun 3, 2016
1 parent 121f031 commit cd7af6a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion py/selenium/webdriver/firefox/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, firefox_profile=None, firefox_binary=None, timeout=30,
self.binary = firefox_binary or capabilities.get("binary", FirefoxBinary())

self.options = firefox_options or Options()
self.options.binary_location = self.binary if isinstance(self.binary, basestring) else self.binary._get_firefox_start_cmd()
self.options.binary_location = self.binary if isinstance(self.binary, basestring) else self.binary._start_cmd
self.options.profile = self.profile
capabilities.update(self.options.to_capabilities())

Expand Down
46 changes: 46 additions & 0 deletions py/test/selenium/webdriver/firefox/mn_binary_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

import pytest
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary


class TestMarionetteBinary:

def test_invalid_binary_str(self):
capabilities = {'marionette': True}
with pytest.raises(WebDriverException) as excinfo:
self.driver = webdriver.Firefox(
capabilities=capabilities,
firefox_binary='foo')
assert 'entity not found' in str(excinfo.value)

def test_invalid_binary_obj(self):
capabilities = {'marionette': True}
with pytest.raises(WebDriverException) as excinfo:
self.driver = webdriver.Firefox(
capabilities=capabilities,
firefox_binary=FirefoxBinary(firefox_path='foo'))
assert 'entity not found' in str(excinfo.value)

def teardown_method(self, method):
try:
self.driver.quit()
except:
pass

0 comments on commit cd7af6a

Please sign in to comment.