def test_004_WEBAuth(self): u'''本地认证(某些设备可能不支持)''' webAutnp = getParameter('webAutnp') Support = getExcelValue(webAutnp) webauth = Organization_userAuthPage(self.driver, self.url) webauth.click_userAuth() time.sleep(1) if Support == '√': logger.info(u'参数支持本地认证') try: self.driver.implicitly_wait(2) webauth.click_WebConfig() except AttributeError or NoSuchElementException: CapPic(self.driver) logger.info(u'软件不支持本地认证,与参数表不符') raise Exception(u'软件不支持本地认证,与参数表不符') else: logger.info(u'软件支持本地认证,与参数表相符') self.driver.implicitly_wait(10) time.sleep(1) #认证页面 webauth.click_modaifyAuthPage() time.sleep(1) webauth.input_webAuthSuccessNote('test') webauth.selelement_byName(webauth.en_picture) webauth.click_activePicEn() time.sleep(0.5) webauth.click_activePicC() time.sleep(0.5) webauth.input_tipstitle('test') webauth.input_tipsinfo('test') webauth.input_hidcontact('test') webauth.click_close_webauth() time.sleep(0.5) webauth.input_staleTime('5') webauth.click_selfenabled() time.sleep(0.2) webauth.click_modalhide() time.sleep(0.5) webauth.click_account() time.sleep(1) webauth.click_addUser() time.sleep(1) selauthType = webauth.selelement_byName(webauth.authType) Select(selauthType).select_by_value('Web') time.sleep(0.3) # 并发数 webauth.input_concurrency('10') # 计费 webauth.click_accountBillEn() time.sleep(0.3) selbillType = webauth.selelement_byName(webauth.billType) Select(selbillType).select_by_value('timeBill') time.sleep(0.3) Select(selbillType).select_by_value('dateBill') time.sleep(0.3) webauth.click_accountBillC() time.sleep(0.3) elif Support == '×': logger.info(u'参数不支持本地认证') try: self.driver.implicitly_wait(2) webauth.click_WebConfig() except AttributeError or NoSuchElementException: logger.info(u'软件不支持web认证,与参数表相符') else: CapPic(self.driver) logger.info(u'软件支持web认证,与参数表不符') raise Exception(u'软件支持web认证,与参数表不符') else: logger.info(u'参数表读取异常') logger.info(u'参数表读取值为:', Support) raise Exception(u'参数表读取异常') self.driver.quit() logger.info('test_004_WEBAuth passed')
def test_003_PPPoESever(self): u'''PPPoE-Sever拨号用户(某些设备可能不支持)''' pppoeSp = getParameter('pppoeSp') Support = getExcelValue(pppoeSp) pppoeauth = Organization_userAuthPage(self.driver, self.url) pppoeauth.click_userAuth() time.sleep(1) if Support != '×': logger.info(u'参数支持PPPoE-Sever') try: self.driver.implicitly_wait(2) pppoeauth.click_PPPoEConfig() except AttributeError or NoSuchElementException: CapPic(self.driver) logger.info(u'软件不支持PPPoE Server,与参数表不符') raise Exception(u'软件不支持PPPoE Server,与参数表不符') else: logger.info(u'软件支持PPPoE Server,与参数表相符') self.driver.implicitly_wait(10) time.sleep(1) pppoeauth.click_PPPoEOnly() pppoeauth.find_selexceptIpGroup() pppoeauth.input_smaxconv('100') pppoeauth.click_selfHelpEnable() pppoeauth.click_PppoeNoticeEn() pppoeauth.input_remainDays('50') pppoeauth.click_edipage() time.sleep(1) pppoeauth.click_NoticePageName() pppoeauth.input_NoticePageNote('test') pppoeauth.input_NoticePageTitle('test') pppoeauth.input_SkipUrl('test') pppoeauth.input_SkipTime('5') pppoeauth.input_NoticeBody('test') pppoeauth.click_close() #关闭 time.sleep(0.5) pppoeauth.click_modalhide() time.sleep(0.5) pppoeauth.click_account() time.sleep(1) pppoeauth.click_addUser() time.sleep(1) #并发数 pppoeauth.input_concurrency('10') #绑定方式 pppoeauth.click_addautoBind() pppoeauth.click_IPBind() pppoeauth.click_MacBind() pppoeauth.click_IPMacBind() pppoeauth.click_noBind() #账号计费 pppoeauth.click_accountBillEn() pppoeauth.click_accountBillC() elif Support == '×': logger.info(u'参数不支持PPPoE-Sever') try: self.driver.implicitly_wait(2) pppoeauth.click_PPPoEConfig() except AttributeError or NoSuchElementException: logger.info(u'软件不支持PPPoE,与参数表相符') else: CapPic(self.driver) logger.info(u'软件支持PPPoE,与参数表不符') raise Exception(u'软件支持PPPoE,与参数表不符') else: logger.info(u'参数表读取异常') logger.info(u'参数表读取值为:', Support) raise Exception(u'参数表读取异常') self.driver.quit() logger.info('test_003_PPPoESever passed')