コード例 #1
0
    def __init__(self, id, name, type, model, version):
        self.id = id
        self.type = type
        self.version = version
        self.model = model
        self.name = name

        if type is DeviceType.IOS:
            type = run(cmd="ideviceinfo | grep ProductType").output
            type = type.replace(',', '')
            type = type.replace('ProductType:', '').strip(' ')
            self.name = type
        if type is DeviceType.SIM:
            self.model = name
        if type is DeviceType.EMU:
            cmd = 'shell getprop ro.product.model'
            model = Adb.run_adb_command(command=cmd,
                                        wait=True,
                                        device_id=self.id).output
            self.model = model.strip('\n\r')
        else:
            self.name = name

        if type is DeviceType.SIM:
            self.device_log_file = Simctl.get_log_file(self.id)
コード例 #2
0
 def clear_log(self):
     """
     Clean device log.
     """
     if self.type is DeviceType.EMU or self.type is DeviceType.ANDROID:
         Adb.clear_logcat(self.id)
     elif self.type is DeviceType.SIM:
         self.device_log_file = Simctl.get_log_file(self.id)
     else:
         raise NotImplementedError('Click not implemented for iOS devices.')
コード例 #3
0
    def __init__(self, id, name, type, version):
        self.id = id
        self.type = type
        self.version = version

        if type is DeviceType.IOS:
            type = run(cmd="ideviceinfo | grep ProductType").output
            type = type.replace(',', '')
            type = type.replace('ProductType:', '').strip(' ')
            self.name = type
        else:
            self.name = name

        if type is DeviceType.SIM:
            self.device_log_file = Simctl.get_log_file(self.id)