Esempio n. 1
0
    def __init__(self, serialno=None, **kwargs):
        """Initial AndroidDevice
        Args:
            serialno: string specify which device

        Returns:
            AndroidDevice object

        Raises:
            EnvironmentError
        """
        self.__display = None
        serialno = serialno or getenvs('ATX_ADB_SERIALNO', 'ANDROID_SERIAL')
        self._host = kwargs.get('host') or getenvs(
            'ATX_ADB_HOST', 'ANDROID_ADB_SERVER_HOST') or '127.0.0.1'
        self._port = int(
            kwargs.get('port')
            or getenvs('ATX_ADB_PORT', 'ANDROID_ADB_SERVER_PORT') or 5037)

        self._adb_client = adbkit.Client(self._host, self._port)
        self._adb_device = self._adb_client.device(serialno)
        self._adb_shell_timeout = 30.0  # max adb shell exec time

        kwargs['adb_server_host'] = kwargs.pop('host', self._host)
        kwargs['adb_server_port'] = kwargs.pop('port', self._port)
        UiaDevice.__init__(self, serialno, **kwargs)
        DeviceMixin.__init__(self)

        self._randid = base.id_generator(5)
        self._uiauto = super(
            AndroidDevice,
            self)  # also will call DeviceMixin method, not very good

        self.screen_rotation = None
        self.screenshot_method = consts.SCREENSHOT_METHOD_AUTO
Esempio n. 2
0
 def __init__(self, *args, **kwargs):
     DeviceMixin.__init__(self)
     self._display = Display(1280, 720)
     self._rotation = 1
     self.last_click = None
     self.serial = '1234'
     self._fail_first_screenshot = False
Esempio n. 3
0
 def __init__(self, *args, **kwargs):
     DeviceMixin.__init__(self)
     self._display = Display(1280, 720)
     self._rotation = 1
     self.last_click = None
     self.serial = '1234'
     self._fail_first_screenshot = False
Esempio n. 4
0
    def __init__(self, device_url, bundle_id=None):
        DeviceMixin.__init__(self)
        self.__device_url = device_url
        self.__scale = None

        self._wda = wda.Client(device_url)
        self._session = None
        self._bundle_id = None

        if bundle_id:
            self.start_app(bundle_id)
    def __init__(self, device_url, bundle_id=None):
        DeviceMixin.__init__(self)
        self.__device_url = device_url
        self.__scale = None
        
        self._wda = wda.Client(device_url)
        self._session = None
        self._bundle_id = None

        if bundle_id:
            self.start_app(bundle_id)
Esempio n. 6
0
    def __init__(self, bundle_id=None, udid=None):
        DeviceMixin.__init__(self)

        self.d = ioskit.Device(udid)
        self.udid = self.d.udid

        self._proc = None
        self._display = None  #Display(2208, 1242)
        self._scale = 1
        self._env = os.environ.copy()
        self._init_display()

        self.screen_rotation = 1  # TODO: auto judge

        if not bundle_id:
            print 'WARNING [ios.py]: bundle_id is not set'  #, use "com.netease.atx.apple" instead.'
            # self._init_instruments('com.netease.atx.apple')
        else:
            self._init_instruments(bundle_id)
Esempio n. 7
0
    def __init__(self, bundle_id=None, udid=None):
        DeviceMixin.__init__(self)

        self.d = ioskit.Device(udid)
        self.udid = self.d.udid

        self._proc = None
        self._display = None #Display(2208, 1242)
        self._scale = 1
        self._env = os.environ.copy()
        self._init_display()

        self.screen_rotation = 1 # TODO: auto judge

        if not bundle_id:
            print 'WARNING [ios.py]: bundle_id is not set' #, use "com.netease.atx.apple" instead.'
            # self._init_instruments('com.netease.atx.apple')
        else:
            self._init_instruments(bundle_id)
Esempio n. 8
0
    def __init__(self, serial=None, **kwargs):
        """Initial AndroidDevice
        Args:
            serial: string specify which device

        Returns:
            AndroidDevice object

        Raises:
            EnvironmentError
        """
        self.__display = None
        serial = serial or getenvs('ATX_ADB_SERIALNO', 'ANDROID_SERIAL')
        self._host = kwargs.get('host') or getenvs(
            'ATX_ADB_HOST', 'ANDROID_ADB_SERVER_HOST') or '127.0.0.1'
        self._port = int(
            kwargs.get('port')
            or getenvs('ATX_ADB_PORT', 'ANDROID_ADB_SERVER_PORT') or 5037)

        self._adb_client = adbkit.Client(self._host, self._port)
        self._adb_device = self._adb_client.device(serial)
        self._adb_shell_timeout = 30.0  # max adb shell exec time

        kwargs['adb_server_host'] = kwargs.pop('host', self._host)
        kwargs['adb_server_port'] = kwargs.pop('port', self._port)

        self._uiauto = UiaDevice(serial, **kwargs)
        DeviceMixin.__init__(self)

        self._randid = base.id_generator(5)

        self.screen_rotation = None
        self.screenshot_method = consts.SCREENSHOT_METHOD_AUTO

        # inherts from atx-uiautomator
        self.swipe = self._uiauto.swipe
        self.drag = self._uiauto.drag
        self.press = self._uiauto.press
        self.long_click = self._uiauto.long_click
        self.dump = self._uiauto.dump
Esempio n. 9
0
    def __init__(self, serial=None, **kwargs):
        """Initial AndroidDevice
        Args:
            serial (str): serial or wlan ip

        Returns:
            AndroidDevice object

        Raises:
            EnvironmentError
        """
        self.__display = None
        serial = serial or getenvs('ATX_ADB_SERIALNO', 'ANDROID_SERIAL')
        self._host = kwargs.get('host') or getenvs(
            'ATX_ADB_HOST', 'ANDROID_ADB_SERVER_HOST') or '127.0.0.1'
        self._port = int(
            kwargs.get('port')
            or getenvs('ATX_ADB_PORT', 'ANDROID_ADB_SERVER_PORT') or 5037)

        self._adb_client = adbkit.Client(self._host, self._port)
        self._adb_device = self._adb_client.device(serial)
        # self._adb_shell_timeout = 30.0 # max adb shell exec time

        # uiautomator2
        self._uiauto = uiautomator2.connect_usb(serial)
        if not self._uiauto.alive:
            self._uiauto.healthcheck(unlock=False)

        DeviceMixin.__init__(self)
        self._randid = base.id_generator(5)

        self.screen_rotation = None

        # inherts from atx-uiautomator
        self.swipe = self._uiauto.swipe
        self.drag = self._uiauto.drag
        self.press = self._uiauto.press
        self.long_click = self._uiauto.long_click
        self.dump = self._uiauto.dump_hierarchy
Esempio n. 10
0
    def __init__(self, serial=None, **kwargs):
        """Initial AndroidDevice
        Args:
            serial (str): serial or wlan ip

        Returns:
            AndroidDevice object

        Raises:
            EnvironmentError
        """
        self.__display = None
        serial = serial or getenvs('ATX_ADB_SERIALNO', 'ANDROID_SERIAL')
        self._host = kwargs.get('host') or getenvs(
            'ATX_ADB_HOST', 'ANDROID_ADB_SERVER_HOST') or '127.0.0.1'
        self._port = int(kwargs.get('port') or getenvs(
            'ATX_ADB_PORT', 'ANDROID_ADB_SERVER_PORT') or 5037)

        self._adb_client = adbkit.Client(self._host, self._port)
        self._adb_device = self._adb_client.device(serial)
        # self._adb_shell_timeout = 30.0 # max adb shell exec time

        # uiautomator2
        self._uiauto = uiautomator2.connect_usb(serial)
        if not self._uiauto.alive:
            self._uiauto.healthcheck(unlock=False)

        DeviceMixin.__init__(self)
        self._randid = base.id_generator(5)

        self.screen_rotation = None

        # inherts from atx-uiautomator
        self.swipe = self._uiauto.swipe
        self.drag = self._uiauto.drag
        self.press = self._uiauto.press
        self.long_click = self._uiauto.long_click
        self.dump = self._uiauto.dump_hierarchy
Esempio n. 11
0
 def __init__(self, device_url):
     DeviceMixin.__init__(self)
     self.__display = None
     self._ymc = _Client(device_url)
Esempio n. 12
0
 def __init__(self, winclass=FrozenWindow, **kwargs):
     DeviceMixin.__init__(self)
     self._win = winclass(**kwargs)
Esempio n. 13
0
 def __init__(self, device_url):
     DeviceMixin.__init__(self)
     self.__display = None
     self._ymc = _Client(device_url)
Esempio n. 14
0
 def __init__(self, winclass=FrozenWindow, **kwargs):
     DeviceMixin.__init__(self)
     self._win = winclass(**kwargs)