def LoginPage(): ''' login in the web page with username pwd and code ''' ie = PAMIE() ie.navigate("http://www.bjguahao.gov.cn/comm/yyks.php?hpid=109") #time.sleep(10) #return ie ie.textBoxSet('truename','ÍõÈý') ie.textBoxSet('sfzhm', 'Éí·ÝÖ¤ºÅ') Downloadcode(ie.cookieGet()) ie.textBoxSet('yzm',GetCode(CodeFilter())) #time.sleep(15) ie.formSubmit('form1') if ie.textBoxExists('truename'): print 'fail to login in, please true again' return None #ie.navigate('http://www.bjguahao.gov.cn/comm/kouqiang/ksyy.php?ksid=1040000&hpid=109') #print ie.pageGetText() #ie.javaScriptExecute(SetDocumentMode()) #ie.javaScriptExecute('document.documentMode="7";') #ie.javaScriptExecute('document.write(document.getElementsByTagName("head"))') #ie.javaScriptExecute('document.getElementsByTagName(\'head\')[0].appendChild(\'<meta http-equiv="X-UA-Compatible" content="IE=7">\');') return ie