Skip to content

Instantly share code, notes, and snippets.

@gunesacar
Last active September 11, 2016 17:12
Show Gist options
  • Save gunesacar/27864fd32d00da4532a5af45d43902a0 to your computer and use it in GitHub Desktop.
Save gunesacar/27864fd32d00da4532a5af45d43902a0 to your computer and use it in GitHub Desktop.
import unittest
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.firefox.webdriver import WebDriver as FirefoxDriver
from selenium.webdriver.firefox.options import Options
NIGHTLY = '/path/to/nightly/firefox'
CAPS = DesiredCapabilities.FIREFOX
CAPS["marionette"] = True
CAPS["binary"] = NIGHTLY
class CustomBinaryPathTest(unittest.TestCase):
def test_geckodriver_binary(self):
driver = webdriver.Firefox(capabilities=CAPS)
self.assertEqual(NIGHTLY, driver.binary)
driver.quit()
def test_options_binary_loc_obj(self):
options = Options()
options.binary_location = FirefoxBinary(NIGHTLY)
driver = FirefoxDriver(firefox_options=options)
self.assertEqual(NIGHTLY, driver.binary)
driver.quit()
def test_options_binary_loc_obj_gecko(self):
options = Options()
options.binary_location = FirefoxBinary(NIGHTLY)
driver = FirefoxDriver(firefox_options=options, capabilities=CAPS)
self.assertEqual(NIGHTLY, driver.binary)
driver.quit()
def test_options_binary_loc_str(self):
options = Options()
options.binary_location = NIGHTLY
driver = FirefoxDriver(firefox_options=options)
self.assertEqual(NIGHTLY, driver.binary)
driver.quit()
def test_options_binary_loc_str_gecko(self):
options = Options()
options.binary_location = NIGHTLY
driver = FirefoxDriver(firefox_options=options, capabilities=CAPS)
self.assertEqual(NIGHTLY, driver.binary)
driver.quit()
def test_firefox_binary_str(self):
driver = webdriver.Firefox(firefox_binary=NIGHTLY)
self.assertEqual(NIGHTLY, driver.binary)
driver.quit()
def test_firefox_binary_str_gecko(self):
driver = webdriver.Firefox(firefox_binary=NIGHTLY, capabilities=CAPS)
self.assertEqual(NIGHTLY, driver.binary)
driver.quit()
def test_firefox_binary_obj(self):
ffbin = FirefoxBinary(NIGHTLY)
driver = webdriver.Firefox(firefox_binary=ffbin)
self.assertEqual(ffbin, driver.binary)
driver.quit()
def test_firefox_binary_obj_gecko(self):
ffbin = FirefoxBinary(NIGHTLY)
driver = webdriver.Firefox(firefox_binary=ffbin, capabilities=CAPS)
self.assertEqual(ffbin, driver.binary)
driver.quit()
if __name__ == "__main__":
pass
@gunesacar
Copy link
Author

Tests to check the status of SeleniumHQ/selenium#1965.
All the tests pass with Selenium>=2.53.3, including 3.0.0b2 (with geckodriver 0.10.0).
NIGHTLY should point to nightly Firefox binary, which should be downloaded separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment