The objective is to hit a local version of GhostDriver, by leveraging the configuration of its path, that the Capabilities allow us to set: https://github.com/detro/ghostdriver/blob/master/README.md#what-extra-webdriver-capabilities-ghostdriver-offers
When running a test with Selenium webdriverjs like the trivial example:
var webdriver = require('selenium-webdriver');
var capabilities = webdriver.Capabilities.phantomjs();
capabilities.set('phantomjs.ghostdriver.path',
'/Users/xyz/ghostdriver-master/src/main.js');
var driver = new webdriver.Builder().
withCapabilities(capabilities).
build();
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnG')).click();
driver.wait(function() {
return driver.getTitle().then(function(title) {
console.log(title);
});
}, 1000);
driver.quit();
I am not able to hit my local version of GhostDriver. It just hits the default version which is baked into phantomjs.
However, if I use WebdriverIO using the same Capability definition:
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
'browserName': 'phantomjs',
'phantomjs.ghostdriver.path': '/Users/xyz/ghostdriver-master/src/main.js'
},
port: 4444
};
webdriverio
.remote(options)
.init()
.url('http://www.google.com')
.title(function(err, res) {
console.log(res.value);
})
.end();
I am able to hit my local version of GhostDriver.
After looking at the documentation here: https://github.com/detro/ghostdriver/blob/master/README.md#what-extra-webdriver-capabilities-ghostdriver-offers
and other pages with similar issues, I was not able to find anything that worked.
versions used:
- selenium-server-standalone v2.51.0
- selenium-webdriver v2.48.2
- webdriverio v4.0.2
- phantomjs v2.1.1
Has anybody got an idea of how to get this working?