def login(self, user, password, exe_path, comm_password=None, **kwargs):
        """
        :param user: 用户名
        :param password: 密码
        :param exe_path: 客户端路径, 类似
        :param comm_password:
        :param kwargs:
        :return:
        """
        if comm_password is None:
            raise ValueError("华泰必须设置通讯密码")

        try:
            self._app = pywinauto.Application().connect(
                path=self._run_exe_path(exe_path), timeout=1
            )
        # pylint: disable=broad-except
        except Exception:
            self._app = pywinauto.Application().start(exe_path)

            # wait login window ready
            while True:
                try:
                    self._app.top_window().Edit1.wait("ready")
                    break
                except RuntimeError:
                    pass

            self._app.top_window().Edit1.type_keys(user)
            self._app.top_window().Edit2.type_keys(password)

            self._app.top_window().Edit3.type_keys(comm_password)

            self._app.top_window().button0.click()

            # detect login is success or not
            self._app.top_window().wait_not("exists", 10)

            self._app = pywinauto.Application().connect(
                path=self._run_exe_path(exe_path), timeout=10
            )
        self._close_prompt_windows()
        self._main = self._app.window(title="网上股票交易系统5.0")
def login ( self , user , password , exe_path , comm_password = None , ** kwargs ) : if comm_password is None : raise ValueError ( "华泰必须设置通讯密码" ) try : self . _app = pywinauto . Application ( ) . connect ( path = self . _run_exe_path ( exe_path ) , timeout = 1 ) except Exception : self . _app = pywinauto . Application ( ) . start ( exe_path ) while True : try : self . _app . top_window ( ) . Edit1 . wait ( "ready" ) break except RuntimeError : pass self . _app . top_window ( ) . Edit1 . type_keys ( user ) self . _app . top_window ( ) . Edit2 . type_keys ( password ) self . _app . top_window ( ) . Edit3 . type_keys ( comm_password ) self . _app . top_window ( ) . button0 . click ( ) self . _app . top_window ( ) . wait_not ( "exists" , 10 ) self . _app = pywinauto . Application ( ) . connect ( path = self . _run_exe_path ( exe_path ) , timeout = 10 ) self . _close_prompt_windows ( ) self . _main = self . _app . window ( title = "网上股票交易系统5.0" )
:param user: 用户名
        :param password: 密码
        :param exe_path: 客户端路径, 类似
        :param comm_password:
        :param kwargs:
        :return: