How to fix error Could not detect Mac OS X Version from sw_vers output: '10.12 ' from Appium

       
      Hi' Guys. Every software developers know the important  of software quality. We're often implement the test case for software manual test. It's help test bug and find errors of software so it's good but it's take so much time and lose focus on software process development. Besides it's waste money  and time because we has to hire software tester. So the Automated Testing is tool help increase quality software development. 
      Currently, I'm an android developer. I'm interested in automated testing and I'm using the Appium tool help in software process development at the Playbasis (Thailand) company. I see other user are got a problem same me about error “Could not detect Mac OS X Version from sw_vers output: '10.12 '”.

Oh my God I tired fix this problem several day. T_T

Wow!!! At last I discovered the solution.



First Step : 

When you're see error you should read error and copy paste error in terminal.

Command by :

  • 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

Use command vim and config each file.

Example


vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/build/lib/system.js
Config file:
  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;
vim /Applications/Appium.app//Contents/Resources/node_modules/appium/node_modules/appium-support/lib/system.js
Config file:


  1. Change From ->
    try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout; }
    To ->
    try { stdout = (await exec('sw_vers', ['-productVersion'])).stdout.trim(); }
  2. 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; } }

For more detail : Stackoverflow full answer


Credit by: Chattip Soontaku (Android Developer)

Popular posts from this blog

เทคนิค ชนะ เกมเศรษฐี 14 ตารวด!!! ( Let's get Rich )

Using Google Chrome Inspect Element to Analyze the website

Easy way to download whole youtube play list and convert them to mp3