def runModalTests(): #----------------------------------------------------------------------------- # print "Validate the modal pop ups" #----------------------------------------------------------------------------- rep.status("Verify the modal pop up functions") ie.linkClick("Modal Popups") testFile = fullPathName + "index.html" location = ie.locationURL() # Click on the browse button to bring up the choose file dialog. rep.status("Testing Download dialog") ie.formName = "installForm" btnname = "install" dialogThread = cModalPopUp.handlePopup("ChooseFile", testFile, "Open") dialogThread.setName('Close dialog thread') dialogThread.start() ie.buttonClick(btnname) time.sleep(0.5) dialogThread.join() rep.verify("Download dialog", ie.textBoxGetValue(btnname, "value"), testFile) # Clicking on the button should popup a modal alert dialog box. rep.status("Testing alert dialog") ie.formName = "form1" dialogThread = cModalPopUp.handlePopup("Alert", "OK") dialogThread.setName('Alert dialog thread') dialogThread.start() ie.buttonClick("alertBtn") time.sleep(0.5) dialogThread.join() rep.verify("Alert Dialog", ie.locationURL(), location + "?alertBtn=Submit+Query") #Clicking on the button should popup a modal confirm dialog box. rep.status("Testing confirm dialog") ie.formName = "form2" dialogThread = cModalPopUp.handlePopup("Confirm", "OK") dialogThread.setName('Confirm dialog thread') dialogThread.start() ie.buttonClick("confirmBtn") time.sleep(0.5) dialogThread.join() rep.verify("Confirm dialog", ie.locationURL(), location + "?confirmBtn=Confirm+Dialog") #Clicking on the button should popup a modal prompt dialog box. rep.status("Testing prompt dialog") ie.formName = "form3" dialogThread = cModalPopUp.handlePopup("Prompt", "Hello World", "OK") dialogThread.setName('Prompt dialog thread') dialogThread.start() ie.buttonClick("promptBtn") time.sleep(0.5) dialogThread.join() print 'Done testing prompt dialog' rep.verify("Prompt dialog", ie.locationURL(), location + "?promptBtn=Prompt+Dialog")
def runModalTests(): #----------------------------------------------------------------------------- # print "Validate the modal pop ups" #----------------------------------------------------------------------------- rep.status ("Verify the modal pop up functions") ie.linkClick ("Modal Popups") testFile = fullPathName + "index.html" location = ie.locationURL() # Click on the browse button to bring up the choose file dialog. rep.status ("Testing Download dialog") ie.formName = "installForm" btnname = "install" dialogThread = cModalPopUp.handlePopup("ChooseFile", testFile, "Open"); dialogThread.setName('Close dialog thread') dialogThread.start(); ie.buttonClick(btnname) time.sleep(0.5) dialogThread.join(); rep.verify ("Download dialog", ie.textBoxGetValue(btnname, "value"), testFile) # Clicking on the button should popup a modal alert dialog box. rep.status ("Testing alert dialog") ie.formName = "form1" dialogThread = cModalPopUp.handlePopup("Alert", "OK"); dialogThread.setName('Alert dialog thread') dialogThread.start(); ie.buttonClick("alertBtn") time.sleep(0.5) dialogThread.join(); rep.verify ("Alert Dialog", ie.locationURL(), location + "?alertBtn=Submit+Query") #Clicking on the button should popup a modal confirm dialog box. rep.status ("Testing confirm dialog") ie.formName = "form2" dialogThread = cModalPopUp.handlePopup("Confirm", "OK"); dialogThread.setName('Confirm dialog thread') dialogThread.start(); ie.buttonClick("confirmBtn") time.sleep(0.5) dialogThread.join(); rep.verify ("Confirm dialog", ie.locationURL(), location + "?confirmBtn=Confirm+Dialog") #Clicking on the button should popup a modal prompt dialog box. rep.status ("Testing prompt dialog") ie.formName = "form3" dialogThread = cModalPopUp.handlePopup("Prompt", "Hello World", "OK"); dialogThread.setName('Prompt dialog thread') dialogThread.start(); ie.buttonClick("promptBtn") time.sleep(0.5) dialogThread.join(); print 'Done testing prompt dialog'; rep.verify ("Prompt dialog", ie.locationURL(), location + "?promptBtn=Prompt+Dialog")
def dialogEventStart(self,strOperate): strTemp = strOperate strTempWnd = '' strTempBtn = '' strTemp = strTemp[strTemp.find('$')+1:len(strTemp)] if strTemp.find('&&') == -1: return False strTempWnd = strTemp[0:strTemp.find('&&')] strTempWnd = strTempWnd[strTempWnd.find('=')+1:len(strTempWnd)] log_public(strTempWnd) strTempBtn = strTemp[strTemp.find('&&')+2:len(strTemp)] strTempBtn = strTempBtn[strTempBtn.find('=')+1:len(strTempBtn)] nTime = 1 aWindow = 0 clickCancel = cModalPopUp.handlePopup('Confirm',strTempBtn) clickCancel.popupName = strTempWnd clickCancel.start() return clickCancel
def dialogEventStart(self, strOperate): strTemp = strOperate strTempWnd = '' strTempBtn = '' strTemp = strTemp[strTemp.find('$') + 1:len(strTemp)] if strTemp.find('&&') == -1: return False strTempWnd = strTemp[0:strTemp.find('&&')] strTempWnd = strTempWnd[strTempWnd.find('=') + 1:len(strTempWnd)] log_public(strTempWnd) strTempBtn = strTemp[strTemp.find('&&') + 2:len(strTemp)] strTempBtn = strTempBtn[strTempBtn.find('=') + 1:len(strTempBtn)] nTime = 1 aWindow = 0 clickCancel = cModalPopUp.handlePopup('Confirm', strTempBtn) clickCancel.popupName = strTempWnd clickCancel.start() return clickCancel
def setProxy(proxy): keyVal = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings' key = OpenKey(HKEY_CURRENT_USER, keyVal, 0, KEY_ALL_ACCESS) SetValueEx(key, 'ProxyEnable', 0,REG_SZ,"1") SetValueEx(key, 'ProxyServer', 0, REG_SZ, proxy) CloseKey(key) setProxy('64.212.73.53:8080') from PAM30 import PAMIE import cModalPopUp import winGuiAuto ie = PAMIE() ie.navigate("http://gzjd.shenyangsheying.com/View.asp?id=20") ie.clickImage("give_ticket.jpg") ok=cModalPopUp.handlePopup("Confirm","È·¶¨") ok.start() ie.quit() ''' hwnd = winGuiAuto.findTopWindows("Windows Internet Explorer") for it in hwnd : control=winGuiAuto.dumpWindow(it) for item in control: if item[1]=='È·¶¨': winGuiAuto.clickButton(item[0]) '''
from _winreg import * def setProxy(proxy): keyVal = 'Software\Microsoft\Windows\CurrentVersion\Internet Settings' key = OpenKey(HKEY_CURRENT_USER, keyVal, 0, KEY_ALL_ACCESS) SetValueEx(key, 'ProxyEnable', 0, REG_SZ, "1") SetValueEx(key, 'ProxyServer', 0, REG_SZ, proxy) CloseKey(key) setProxy('64.212.73.53:8080') from PAM30 import PAMIE import cModalPopUp import winGuiAuto ie = PAMIE() ie.navigate("http://gzjd.shenyangsheying.com/View.asp?id=20") ie.clickImage("give_ticket.jpg") ok = cModalPopUp.handlePopup("Confirm", "È·¶¨") ok.start() ie.quit() ''' hwnd = winGuiAuto.findTopWindows("Windows Internet Explorer") for it in hwnd : control=winGuiAuto.dumpWindow(it) for item in control: if item[1]=='È·¶¨': winGuiAuto.clickButton(item[0]) '''