1.检查appium环境报错
2. 原因
appium不兼容最新的mac10.12版本。由于10.12是最新mac版本,appium当前版本并未提供支持。
3. 解决方法
命令行输入:grep -rl "Could not detect Mac OS X Version from sw_vers output:" /Applications/Appium.app/
Terminal will show : /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js
使用命令vim编辑上述每一个输出。
(1)
Change From ->
case 10:
_arr = ['10.8', '10.9', '10.10', '10.11'];
_i = 0;
To ->
case 10:
_arr = ['10.8', '10.9', '10.10', '10.11','10.12'];
_i = 0;
(2)
a.
Change From ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout;
}
To ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim();
}
b.
Change From ->
for (let v of ['10.8', '10.9', '10.10', '10.11']) {
if (stdout.indexOf(v) === 0) { return v; }
}
To ->
for (let v of ['10.8', '10.9', '10.10', '10.11','10.12']) {
if (stdout.indexOf(v) === 0) { return v; }
}
(3)
Change From ->
case 10:
_arr = ['10.8', '10.9', '10.10', '10.11'];
_i = 0;
To ->
case 10:
_arr = ['10.8', '10.9', '10.10', '10.11','10.12'];
_i = 0;
(4)
a.
Change From ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout;
}
To ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim();
}
b.
Change From ->
for (let v of ['10.8', '10.9', '10.10', '10.11']) {
if (stdout.indexOf(v) === 0) { return v; }
}
To ->
for (let v of ['10.8', '10.9', '10.10', '10.11','10.12']) {
if (stdout.indexOf(v) === 0) { return v; }
}