This error only happens when I spawn the ios-driver jar as a Node.js child.
The error is java.net.SocketException: Protocol family unavailable
selenium-test.js:
var spawn = require('child_process').spawn;
var selenium = spawn('java', ['-jar', './ios-server-standalone-0.6.6-SNAPSHOT.jar', '-port', '4444']);
selenium.stderr.setEncoding('utf8');
selenium.stderr.on('data', function (data){
console.log(data);
});
webdriverjs-test.js (webdriverjs)
var webdriverjs = require('webdriverjs');
var options = {
desiredCapabilities: {
browserName: 'safari',
platform: 'OS X 10.9',
version: '7.1',
device: 'iphone'
}
};
webdriverjs
.remote(options)
.init()
.end();
Reproduce this error by creating the above files, running selenium-test.js in one window and webdriverjs-test.js in another window. You will first need to npm install webdriverjs
and curl -O http://ios-driver-ci.ebaystratus.com/userContent/ios-server-standalone-0.6.6-SNAPSHOT.jar
Version info:
$ java version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
$ node -v
v0.10.26
Why does this error happen and how do I fix it?
I managed to solve this by making the spawned child ignore stdin:
var selenium = spawn('java', ['-jar', './ios-server-standalone-0.6.6-SNAPSHOT.jar', '-port', '4444'], {stdio: ['ignore', null, null]});
I'm not sure why this workaround works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With