Appium night God simulator NoxConsole

  • 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
  1. Delete and increase simulator needs to be performed in the bin directory of the installation directory; otherwise it will error;
  2. First, switch to the directory, and then perform the addition and deletion of work;

  3. Use NoxConsole.exe, do not use NoxConsole;

  4. 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
  1. 127.0.0.1:62001
  2. 127.0.0.1:62025
  3. 127.0.0.1:62026
  • Rename:
  1. NoxConsole rename -name: Yagami simulator -title: 127.0.0.1: 62001
  2. NoxConsole launch -name:127.0.0.1:62001



Guess you like

Origin www.cnblogs.com/breakcircle/p/12509616.html