- Do appium automation of time, if the test multiple devices, multiple virtual machines when needed, you need to create multiple simulators;
- Yagami simulator provides a command script to create NoxConsole
- NoxConsole directory / bin
- Summary of the issues in use
- Start the night God Simulator: Installation environment variables added
- Delete and increase simulator needs to be performed in the bin directory of the installation directory; otherwise it will error;
-
First, switch to the directory, and then perform the addition and deletion of work;
-
Use NoxConsole.exe, do not use NoxConsole;
-
After the execution is completed, be sure to switch back to the original path, or else the result of many functions in question; as aapt
-
DEF change_dir (App): '' ' switching application directory : param App: : return: ' '' the try : cmd = ' WHERE ' + STR (App) RES = send_cmd (cmd = cmd) the dir = " \\ " .join (res.split ( " \\ " ) [: -. 1 ]) RES = the os.chdir (the dir) path = The os.getcwd () log.info ( " current path:% S " % path) the except Exception as err: raise Exception("change dir path fail: %s" % str(err)) def create_phone(num): ''' 创建夜神模拟器 :return: ''' cmd = 'NoxConsole quitall' res = (os.popen(cmd)).read() time.sleep(1) pro_path = os.path.dirname(__file__) for i in range(int(num)): if i == 0: nox_name = '127.0.0.1:62001 ' the else : nox_name = ' 127.0.0.1: ' + STR (I - + 62025. 1 ) # because the creation of a new virtual machine needs to be in the root directory NoxConsole, so to switch to the directory to change_dir ( " NoxConsole " ) cmd = ' NoxConsole.exe the Add -name: ' + + nox_name ' -systemtype:. 5 ' RES = (os.popen, (cmd)) Read (). cmd = ' NoxConsole.exe Modify -name: ' + + nox_name ' --resolution: 1080,1920,270' res = (os.popen(cmd)).read() time.sleep(1) cmd = 'NoxConsole.exe rename -name:' + nox_name + ' -title:' + nox_name res = (os.popen(cmd)).read() cmd = 'NoxConsole.exe launch -name:' + nox_name res = (os.popen(cmd)).read() time.sleep(3) log.info('Virtual phone is launching, plaease wait 60s...') os.chdir(pro_path) time.sleep(Wait.launch_virtual_time)
- Yagami simulator naming convention: the second is 62025, after adding a
- 127.0.0.1:62001
- 127.0.0.1:62025
- 127.0.0.1:62026
- Rename:
- NoxConsole rename -name: Yagami simulator -title: 127.0.0.1: 62001
- NoxConsole launch -name:127.0.0.1:62001