rw_Excel_FLOW.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码
def Onu_login(self,FlowName):
        print 'onu_login fuction'
        if self.Onu_login_Flag == 1 :
            return True
        ap_name = FlowName.split('_')[-1]
        if ap_name =='ONU':
            login_username = LOGIN_USERNAME_GONGJIN
            login_password = LOGIN_PASSWORD_GONGJIN
            print 'GONGJIN:login_username--',login_username
            print 'GONGJIN:login_password--',login_password
        test_win = win_gui()

        hwnd = win32gui.FindWindow('#32770',None)
        print 'hwnd is ',hwnd
        if hwnd < 1:
            log_public(WEB_ERR_NO_0020)
            self.m_ERROR_MSG = WEB_ERR_NO_0020
            return False
        else:
            win32api.Sleep(100)
            win32api.keybd_event(18,0,0,0);
            win32api.keybd_event(85,0,0,0);
            win32api.Sleep(100)
            win32api.keybd_event(85,0,win32con.KEYEVENTF_KEYUP,0);
            win32api.keybd_event(18,0,win32con.KEYEVENTF_KEYUP,0);
            win32api.Sleep(100)
            shell = win32com.client.Dispatch("WScript.Shell")
            shell.SendKeys(login_username)

            win32api.Sleep(100)
            win32api.keybd_event(18,0,0,0);
            win32api.keybd_event(80,0,0,0);
            win32api.Sleep(100)
            win32api.keybd_event(80,0,win32con.KEYEVENTF_KEYUP,0);
            win32api.keybd_event(18,0,win32con.KEYEVENTF_KEYUP,0);
            win32api.Sleep(300)
            shell.SendKeys(login_password)
            win32api.Sleep(100)
            win32api.keybd_event(13,0,0,0);   
            win32api.Sleep(100)
            win32api.keybd_event(13,0,win32con.KEYEVENTF_KEYUP,0);
            win32api.Sleep(100)
            return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号