Last active
September 11, 2016 17:12
-
-
Save gunesacar/27864fd32d00da4532a5af45d43902a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.