My test suite was failing because selenium-webdriver 2.41.0 doesn’t support sendKeys
for <input type='number'>
with Firefox 29. But downgrading my system Firefox to an older version just to run a test suite seems crazy. Why not just download an older version of Firefox, and set the firefox binary to use, as you would with selenium webdriver in python?
Alas, the webdriver-js docs give no hint as to how this might be done. After digging into the source code for selenium-webdriver remote and the documentation for the Firefox remote webdriver, here’s how it’s done:
var SeleniumServer = require("selenium-webdriver/remote"),
webdriver = require("selenium-webdriver");
var seleniumPath = "/path/to/selenium-server-standalone.jar";
var firefoxPath = "/path/to/firefox-28/firefox";
var server = new SeleniumServer(seleniumPath, {
port: 4444,
jvmArgs: ["-Dwebdriver.firefox.bin=" + firefoxPath]
});
server.start().then(function() {
var browser = new webdriver.Builder().usingServer(
server.address()
).withCapabilities(
webdriver.Capabilities.firefox()
).build();
// browser is now tied to firefox-28!
});
As a bonus, while testing this, I also discovered that you can enable verbose logging for the standalone webdriver by adding the option stdio: "inherit"
to the constructor for SeleniumServer, e.g.:
var server = new SeleniumServer(seleniumPath, {
port: 4444,
stdio: "inherit",
...
});
This ought to be helpful in debugging issues around getting the standalone server going.