コード例 #1
0
ファイル: zxtouch.py プロジェクト: mkYYY/IOS13-SimulateTouch
    def hide_keyboard(self):
        """hide the keyboard

        :return: Result tuple: (success?, error_message/return value)
        """
        self.s.send(
            datahandler.format_socket_data(
                tasktypes.TASK_KEYBOARDIMPL,
                kbdtasktypes.KEYBOARD_VIRTUAL_KEYBOARD, 1))
        return datahandler.decode_socket_data(self.s.recv(1024))
コード例 #2
0
ファイル: zxtouch.py プロジェクト: mkYYY/IOS13-SimulateTouch
    def switch_to_app(self, bundle_identifier):
        """Bring an application to foreground

        :param bundle_identifier: the bundle id of the application
        :return: Result tuple: (success?, error_message/return value)
        """
        self.s.send(
            datahandler.format_socket_data(
                tasktypes.TASK_PROCESS_BRING_FOREGROUND, bundle_identifier))
        return datahandler.decode_socket_data(self.s.recv(1024))
コード例 #3
0
ファイル: zxtouch.py プロジェクト: mkYYY/IOS13-SimulateTouch
    def move_cursor(self, offset):
        """Move the cursor on the text field

        :param offset: the related position you want to move. To move left, offset should be negative. For moving right, it should be positive.
        :return:
        """
        self.s.send(
            datahandler.format_socket_data(tasktypes.TASK_KEYBOARDIMPL,
                                           kbdtasktypes.KEYBOARD_MOVE_CURSOR,
                                           offset))
        return datahandler.decode_socket_data(self.s.recv(1024))
コード例 #4
0
ファイル: zxtouch.py プロジェクト: mkYYY/IOS13-SimulateTouch
    def insert_text(self, text):
        """Insert text into the text field

        :param text: text to insert
        :return:
        """
        for i, ch in enumerate(text):
            if ch == "\b":
                self.s.send(
                    datahandler.format_socket_data(
                        tasktypes.TASK_KEYBOARDIMPL,
                        kbdtasktypes.KEYBOARD_DELETE_CHARACTERS, 1))
                datahandler.decode_socket_data(self.s.recv(1024))
            else:
                self.s.send(
                    datahandler.format_socket_data(
                        tasktypes.TASK_KEYBOARDIMPL,
                        kbdtasktypes.KEYBOARD_INSERT_TEXT, ch))
                datahandler.decode_socket_data(self.s.recv(1024))
        return (True, "")
コード例 #5
0
ファイル: zxtouch.py プロジェクト: mkYYY/IOS13-SimulateTouch
    def get_screen_size(self):
        """Get screen size in pixels

        :return: Result tuple: (success?, error_message/dictionary that stores the result)
        """
        self.s.send(
            datahandler.format_socket_data(
                tasktypes.TASK_GET_DEVICE_INFO,
                deviceinfotasktypes.DEVICE_INFO_TASK_GET_SCREEN_SIZE))
        result = datahandler.decode_socket_data(self.s.recv(1024))
        if not result[0]:
            return False, result[1]
        return True, {"width": result[1][0], "height": result[1][1]}
コード例 #6
0
ファイル: zxtouch.py プロジェクト: mkYYY/IOS13-SimulateTouch
    def get_rgb_from_screen(self, x, y):
        """Get the rgb value from the screen. The format returned is (red, green, blue)

        :param x: x coordinate of the point on the screen
        :param y: y coordinate of the point on the screen
        :return: Result tuple: (success?, error_message/dictionary that stores the result)
        """
        self.s.send(
            datahandler.format_socket_data(tasktypes.TASK_COLOR_PICKER, x, y))
        result = datahandler.decode_socket_data(self.s.recv(1024))
        if not result[0]:
            return False, result[1]

        return True, {
            "red": result[1][0],
            "green": result[1][1],
            "blue": result[1][2]
        }
コード例 #7
0
ファイル: zxtouch.py プロジェクト: mkYYY/IOS13-SimulateTouch
    def show_toast(self,
                   toast_type,
                   content,
                   duration,
                   position=0,
                   fontSize=0):
        """Show toast on ios device

        :param type: type of the toast.
        :param content: content of the toast
        :param duration: duration of the toast
        :param position: position of the toast. 0 for top, 1 for bottom
        :return: Result tuple: (success?, error_message/return value)
        """
        self.s.send(
            datahandler.format_socket_data(tasktypes.TASK_SHOW_TOAST,
                                           toast_type, content, duration,
                                           position, fontSize))
        return datahandler.decode_socket_data(self.s.recv(1024))