admin管理员组文章数量:1022957
This error only happens when I spawn the ios-driver jar as a Node.js child.
The error is java.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 .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?
This error only happens when I spawn the ios-driver jar as a Node.js child.
The error is java.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./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?
Share Improve this question edited Dec 14, 2017 at 14:19 iamdanchiv 4,1124 gold badges38 silver badges42 bronze badges asked Apr 3, 2014 at 4:05 MarosMaros 1,9834 gold badges27 silver badges58 bronze badges 4-
Host about
var selenium = spawn('java', ['-jar', './ios-server-standalone-0.6.6-SNAPSHOT.jar', '-port', '4444', '-host', '127.0.0.1']);
? – Joachim Isaksson Commented Apr 3, 2014 at 4:23 - Just tried. Same issue happens. – Maros Commented Apr 3, 2014 at 4:25
- Do you have JAVA_OPTS that has -Djava.preferIPv4Stack=true in your environment. That could be a reason. Also try passing them to your child process. See this question – user568109 Commented Apr 3, 2014 at 4:54
-
I don't think so. I can inspect the output of
env
in my shell and in the child shell and they are almost the same. – Maros Commented Apr 4, 2014 at 0:25
2 Answers
Reset to default 5I 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.
I don't have much idea about it, what so far I've found is that this can be binding issue with java. More details is on following link:(It is not the updated information, it may lead to answer)
http://diario.beerensalat.info/2008/10/12/java_and_ipv6_on_bsd.html
If that is not the case, as this post suggests to change it to higher port should work. "Protocol family unavailable" error while using VisualVM
This error only happens when I spawn the ios-driver jar as a Node.js child.
The error is java.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 .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?
This error only happens when I spawn the ios-driver jar as a Node.js child.
The error is java.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./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?
Share Improve this question edited Dec 14, 2017 at 14:19 iamdanchiv 4,1124 gold badges38 silver badges42 bronze badges asked Apr 3, 2014 at 4:05 MarosMaros 1,9834 gold badges27 silver badges58 bronze badges 4-
Host about
var selenium = spawn('java', ['-jar', './ios-server-standalone-0.6.6-SNAPSHOT.jar', '-port', '4444', '-host', '127.0.0.1']);
? – Joachim Isaksson Commented Apr 3, 2014 at 4:23 - Just tried. Same issue happens. – Maros Commented Apr 3, 2014 at 4:25
- Do you have JAVA_OPTS that has -Djava.preferIPv4Stack=true in your environment. That could be a reason. Also try passing them to your child process. See this question – user568109 Commented Apr 3, 2014 at 4:54
-
I don't think so. I can inspect the output of
env
in my shell and in the child shell and they are almost the same. – Maros Commented Apr 4, 2014 at 0:25
2 Answers
Reset to default 5I 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.
I don't have much idea about it, what so far I've found is that this can be binding issue with java. More details is on following link:(It is not the updated information, it may lead to answer)
http://diario.beerensalat.info/2008/10/12/java_and_ipv6_on_bsd.html
If that is not the case, as this post suggests to change it to higher port should work. "Protocol family unavailable" error while using VisualVM
本文标签: javascriptNodejs Selenium IPv6 Issue (SocketException Protocol family unavailable)Stack Overflow
版权声明:本文标题:javascript - Node.js Selenium IPv6 Issue (SocketException Protocol family unavailable) - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745548039a2155487.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论