SeleniumHQ/selenium

Exception: Firefox option was set, but is not a FirefoxOption:

Closed this issue · 10 comments

Setup

OS: Centos 7
Selenium version: 3.0.1
Bindings: Python using remote driver
Browser: Firefox 49.0.2
Driver: geckodriver v0.11.1

Description

When setting the binary or profile in the webdriver.firefox.options.Options(), once the option is passed along it's rejected with

Driver info: driver.version: FirefoxDriver
        at org.openqa.selenium.firefox.FirefoxDriver.populateProfile(FirefoxDriver.java:205)
        at org.openqa.selenium.firefox.FirefoxDriver.extractProfile(FirefoxDriver.java:168)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:135)
        ... 14 more
14:51:51.354 WARN - Exception: Firefox option was set, but is not a FirefoxOption: {binary=/usr/bin/firefox, profile=UEsDBBQAAAAIAFR2Y0kXL5f1wgMAACUNAAAHAAAAdXNlci5qc5VXTW/bOBC991csfOoCGyIf20t7StMUKFBsFjWCHgmKHFmMKZJLDq343++Qshonlmn3ZklDzsybeW/GKULgPkD7fhFRBEyeda4HL1bABzCSfvMUDBNKadTOCrP464+FaFzCj40Rdr3489O79HKJa1ujLVwI7yMTxriBN1uuoBXJIB3FkOD1CeV61otnLruQnUUZtEcekuWoe6AjN5evDzTBDfTEUDSRDSLYB3tnXMymrTAR5q0pqjVzHiyHZ4QwJnL92jZ/sZGyjKwxTq6NjsjAisaAmr9970TySiAw61C320cymT/x7LUlpI1hQ6cRiosA/yUdjvmYMlBusMYJRWhZKk9gsXPDzw7sMhdO29X8cQUbdM5EBiG4IClUZ2Avq8OKTA6jaKH8prvrMDyJjRgLV72YABIBvCvRsg6EwW58ZsatVvnlLr77mrdf8e0aNjcrWV6e7Sz5jGPVxwCNCnpDz2NC3AqkRw4bsBhns9vrBdmBXN+53tOhRhuNW2b1qkOzrWckBZ1kSsf1Dsd58wgyhXxpqw3QL+aCJvS4d0bL7OJm/np6pR7sT22pleLVJdMWg3v88b1O6dl26IUh6kG9LSolIKONlkAZhIg/kj2RqIy+isge9lMnVRuRNIdQLoUtmqDIjV3x3Bb1CgUQKnMRECSC+prDv6X8ZIns0FOm3lojs4CDC+uJujvnVUE8rYSH6lMvB108ws9Jf/hTJCmU4LOsz3f0lLSFgcQ206zuwJOCe4xZmXnvlDB18+n63cyYN9oBtxO9i2m+EPcxxXPabiQFyy+Xqel1zID9W17eypz+sfCm0pFIQw8YtudlEzsgcS8K8GUce5/HL6fmQdQrEpkUIJ4YCAf0jxi0RP5WBSpBetI26pdfdBYJXZHTah/sTdwHYk3dxdg0jJaHM+UFSmUiOpIVAiHRMtBSQ3EZROxOqbSI5UAiRUuRSsqpzqlgXhXqnPeXkYtLSUqQO+rqyL5x//j9lt0w8dI0ldEJpo3Jj9NmRGBxqrsCPBVNmb2Y9qmJ4znmE7sOmQXSjXrDTszqEGmGdjp224v82ROWFwbsCjPq1x8+HFtHejaUUcJU6n1Vb/fqVNDbq5OEcGSeHiI06kvxcX0MdxFkt0Pq5K7iRu0ri9Q3ezeuHr+7uUyT7DxxeLNjn0mNt5u5IyiDVsB6oktRzgWJBxHnyAUvyy+xcizaIYZnyOZZaxnNNm/EFtT91eXyH1qHZQ7w7zcaVvmzUQdljwlVyLOcOkus6qFvICzL45GJ8YriE7gvjfA/UEsBAhQDFAAAAAgAVHZjSRcvl/XCAwAAJQ0AAAcAAAAAAAAAAAAAAKSBAAAAAHVzZXIuanNQSwUGAAAAAAEAAQA1AAAA5wMAAAAA}

code

		dcap = DesiredCapabilities.FIREFOX.copy() 
		dcap["marionette"] = True

		fpoptions = webdriver.firefox.options.Options()
		fpoptions.binary = webdriver.firefox.firefox_binary.FirefoxBinary() 
		fpoptions.binary._start_cmd = "/usr/bin/firefox"

		

		fp = webdriver.FirefoxProfile()
		fp.set_preference("browser.cache.disk.enable",False)
		fp.set_preference("browser.privatebrowsing.autostart", True)
		fp.update_preferences()
		fpoptions.profile = fp
		dcap.update(fpoptions.to_capabilities())

                browser = webdriver.Remote(command_executor="http://127.0.0.1:4444/wd/hub",proxy=proxy,desired_capabilities=dcap)

In java, you can reproduce adding this in the capabilities:

JsonObject options = new JsonObject();
JsonObject log = new JsonObject();
log.addProperty("level", "trace");
options.add("log", log);
capabilities.setCapability("moz:firefoxOptions", options);
Caused by: org.openqa.selenium.WebDriverException: Firefox option was set, but is not a FirefoxOption: {log={level=trace}}
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'bluwin', ip: '192.168.0.23', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_92'
Driver info: driver.version: FirefoxDriver

I think this originates from the Java side. There are no such checks in the Python bindings.

Selenium shouldn’t have to validate the correctness of the moz:firefoxOptions dictionary. The only authoritative checks for that can be done in geckodriver.

Is there a workaround for this at present other than rolling back to a beta release of the JS lib? I have written code dependent on a feature added in 3.0.0+ to the JS lib for disabling the promise manager and just found out I can't use the firefox driver without this error popping up.

Reproduced issues with

Firefox 51.0.1
Selenium jar : 3.0.1 and 3.0

after downgrading selenium to 3.0.0-beta-4 works.

Issue reproduced with:

Firefox 52.0a2
Selenium jar: 3.0.1

@shs96c do you have any idea? You seems to be the man behind the check (fdd21f9)

This is fixed in Selenium 3.3.1 with commit bc4c207.

This is still reproducible:
Selenium v3.4.0 (Java bindings)
Firefox: v52.0.2 & v53.0
GeckoDriver: v0.16.0

DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability("moz:firefoxOptions", new JsonParser().parse("{log: {level: trace}}"));
FirefoxDriver firefoxDriver = new FirefoxDriver(dc);
org.openqa.selenium.WebDriverException: Firefox option was set, but is not a FirefoxOption: {"log":{"level":"trace"}}
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: '<deleted>', ip: '<deleted>', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.4', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
	at org.openqa.selenium.firefox.FirefoxDriver.getFirefoxOptions(FirefoxDriver.java:229)

Triaging old issues whille preparing to 4.0 release.

This issue is not actual anymore, the provided samples work well in Selenium 3.14