其他分享
首页 > 其他分享> > android – 如何从Appium修复错误“无法从sw_vers输出检测Mac OS X版本:’10 .12’”

android – 如何从Appium修复错误“无法从sw_vers输出检测Mac OS X版本:’10 .12’”

作者:互联网

我安装了appium-1.5.3.dmg但是当我点击听诊器按钮时,Appium显示错误:

 ✔ Xcode is installed at: /Library/Developer/CommandLineTools
[Error: Could not detect Mac OS X Version from sw_vers output: '10.12
']

谢谢!

解决方法:

它对我有用.

您可以通过此命令配置文件:

> grep -rl“无法从sw_vers输出中检测到Mac OS X版本:”/ Applications / Appium.app /

enter image description here

>终端将显示:
/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并配置每个文件.

vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js

enter image description here

配置文件:

enter image description here

>改变自 – >

案例10:
    _arr = [’10 .8′,’10 .9′,’10 .10′,’10 .11′];
    _i = 0;

到 – >

案例10:
    _arr = [’10 .8′,’10 .9′,’10 .10′,’10 .11′,’10.12′];
    _i = 0;

vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js

enter image description here

配置文件:

enter image description here

>改变自 – >

尝试{
stdout =(等待exec(‘sw_vers’,[‘ – productVersion’])).stdout;
}

到 – >

尝试{
stdout =(等待exec(‘sw_vers’,[‘ – productVersion’])).stdout.trim();
}
>改变自 – >

for(let v of [’10 .8′,’10 .9′,’10 .10′,’10 .11′]){
if(stdout.indexOf(v)=== 0){return v; }
}

到 – >

for(let of of [’10 .8′,’10 .9′,’10 .10′,’10 .11′,’10.12′]){
if(stdout.indexOf(v)=== 0){return v; }
}

vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js

enter image description here

配置文件:

enter image description here

>改变自 – >

案例10:
    _arr = [’10 .8′,’10 .9′,’10 .10′,’10 .11′];
    _i = 0;

到 – >

案例10:
    _arr = [’10 .8′,’10 .9′,’10 .10′,’10 .11′,’10.12′];
    _i = 0;

vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js

enter image description here

配置文件:

enter image description here

>改变自 – >

尝试{
stdout =(等待exec(‘sw_vers’,[‘ – productVersion’])).stdout;
}

到 – >

尝试{
stdout =(等待exec(‘sw_vers’,[‘ – productVersion’])).stdout.trim();
}
>改变自 – >

for(let v of [’10 .8′,’10 .9′,’10 .10′,’10 .11′]){
if(stdout.indexOf(v)=== 0){return v; }
}

到 – >

for(let of of [’10 .8′,’10 .9′,’10 .10′,’10 .11′,’10.12′]){
if(stdout.indexOf(v)=== 0){return v; }
}

单击启动听诊器按钮

enter image description here

标签:appium,android,automated-tests
来源: https://codeday.me/bug/20190928/1826920.html