执行环境:appium:V 1.5.3
Mac:V10.12
Appium 在Mac系统上检查环境时异常(如图)
【原因】:
mac系统的版本太高,Appium还没有兼容设置此版本。
【解决】
修改Appium的配置,具体如下:
1、vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js
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、vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js
Change From ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout;
}
To ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim();
}
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、vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/build/lib/system.js
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、vim /Applications/Appium.app//Contents/Resources/node_modules/appium-support/lib/system.js
Change From ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout;
}
To ->
try {
stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim();
}
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; }
}
【验证】