示例#1
0
    def test_001_openRemoteAuth(self):
        u'''开启远程认证'''
        if Support == '√':
            logger.info(u'参数支持远程认证')
            organization_group.import_empty_template(self)  # 判断组织架构是否有其他组 有则清空

            # 打开用户管理 - 用户认证
            login.loginWeb(self)  # admin账号登录
            self.driver.implicitly_wait(10)
            remoteauth = Organization_userAuthPage(self.driver, self.url)
            remoteauth.click_UserManage()
            time.sleep(0.3)
            remoteauth.click_userAuth()
            time.sleep(1)
            # 开启远程认证
            remoteauth.click_remoteAuthEn()
            time.sleep(0.5)
            # 断言 提示信息是否有误
            status = str(
                remoteauth.getAttribute_byXpath(remoteauth.remoteAuthEs,
                                                'checked'))
            self.assertEqual(status, 'true', msg='远程认证开启出错')
            time.sleep(1)
            self.driver.quit()
            print('远程认证 开启成功')

            # 新增用户组及PC的组织架构
            organization_group.add_user(self)
            time.sleep(1)
        elif Support == '×':
            logger.info(u'参数不支持远程认证')
        logger.info('test_001_openRemoteAuth passed')
示例#2
0
    def test_003_closeWebAuth(self):
        u'''关闭web认证'''
        if Support == '√':
            logger.info(u'参数支持本地认证')
            # 打开用户管理 - 用户认证
            login.loginWeb(self)  # admin账号登录
            self.driver.implicitly_wait(10)
            webauth = Organization_userAuthPage(self.driver, self.url)
            # 打开用户管理 - 用户认证
            webauth.click_UserManage()
            time.sleep(0.5)
            webauth.click_userAuth()
            time.sleep(1)
             # 开启web认证
            webauth.click_WebAuthC()
            time.sleep(1)
            # 断言 提示信息是否有误
            status = str(webauth.getAttribute_byXpath(webauth.WebAuthCs,'checked'))
            time.sleep(1)
            self.assertEqual(status, 'true', msg='web认证关闭出错')
            self.driver.quit()
            print('web认证关闭 验证成功')

            # 清空组织架构组
            organization_group.import_empty_template(self)  # 判断组织架构是否有其他组 有则清空
            print('删除组织架构组 完成')
        elif Support == '×':
            logger.info(u'参数不支持本地认证')
        logger.info('test_003_closeWebAuth passed')
示例#3
0
    def test_001_openWebAuth(self):
        u'''web认证开启'''
        host = gettelnet('host').split(r'.')
        host1 = host[0] + '.' + host[1] + '.' + host[2] +'.'
        # 006中设置了指定IP,这里增加一个判断联网
        pcaddr = socket.gethostbyname(socket.getfqdn(socket.gethostname()))
        print(pcaddr)
        pingTestIP()  # 避免判断失误

        p = pingTestIP()
        if p == 'N' or host1 not in pcaddr:  # 如果不通 or 地址不为lan口网段
            # 1、改回DHCP, 调用bat脚本
            os.system('%s' % (batpath + 'changeDhcpIp.bat'))
            time.sleep(5)
            n = 0
            while n < 30:
                # 获取本机ip 默认有线地址,有线断开会显示无线
                pcaddr_new = socket.gethostbyname(socket.getfqdn(socket.gethostname()))
                print(pcaddr_new, n)
                if '192.168.' not in str(pcaddr_new):
                    time.sleep(2)
                    n += 1
                else:
                    print('IP地址已自动获取成功', n)
                    break
            else:
                raise Exception('未获取到地址')

        if Support == '√':
            logger.info(u'参数支持本地认证')
            organization_group.import_empty_template(self)  # 判断组织架构是否有其他组 有则清空

            # 打开用户管理 - 用户认证
            login.loginWeb(self)  # admin账号登录
            self.driver.implicitly_wait(10)
            webauth = Organization_userAuthPage(self.driver, self.url)
            # 打开用户管理 - 用户认证
            webauth.click_UserManage()
            time.sleep(0.5)
            webauth.click_userAuth()
            time.sleep(1)
            #开启web认证
            webauth.click_WebAuthEn()
            time.sleep(1)
            # 断言 提示信息是否有误
            status = str(webauth.getAttribute_byXpath(webauth.WebAuthEs,'checked'))
            time.sleep(1)
            self.assertEqual(status,'true',msg='web认证开启出错')
            self.driver.quit()
        elif Support == '×':
            logger.info(u'参数不支持本地认证')
        logger.info('test_001_openWebAuth passed')
示例#4
0
    def test_003_FreeAuthAll(self):
        u'''免认证 - 所有用户'''
        time.sleep(2)
        freeauth = Organization_userAuthPage(self.driver, self.url)
        freeauth.click_noConfig()
        time.sleep(1)
        freeauth.click_alluser()
        time.sleep(0.5)
        freeauth.click_save()
        time.sleep(5)

        # 打开网页验证 断言
        self.driver.get('http://www.baidu.com')
        time.sleep(2)
        title1 = self.driver.title
        # print(title1)
        self.assertEqual(title1, '百度一下,你就知道', msg='免认证 组织架构 出错')
        self.driver.quit()
        logger.info('test_003_FreeAuthAll passed')
    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')
示例#7
0
    def test_001_openPPPoEAuth_addAcc(self):
        u'''开启PPPoE认证 - 创建PPPoE账号'''

        # 005中设置了黑名单上网,这里增加一个判断联网
        nodata = getAssertText('nodata')
        # 判断联网 ,不能则改回mac
        p = pingTestIP('www.baidu.com')
        if p == 'N':
            # 将mac改回
            # 调用bat脚本
            os.system('%s' % (batpath + 'changeMacToBack.bat'))
            time.sleep(5)
            n = 0
            while n < 30:
                # 获取本机ip 默认有线地址,有线断开会显示无线
                pcaddr_new = socket.gethostbyname(
                    socket.getfqdn(socket.gethostname()))
                print(pcaddr_new, n)
                if '192.168.' not in str(pcaddr_new):
                    time.sleep(2)
                    n += 1
                else:
                    print('IP地址已自动获取成功', n)
                    break
            else:
                # raise Exception('未获取到地址1')
                # 开启绑定情况下 仅更改mac 可能会获取不到地址
                os.system('%s' % (batpath + 'ipconfig_release.bat'))
                time.sleep(5)
                os.system('%s' % (batpath + 'ipconfig_renew.bat'))
                time.sleep(5)
                i = 0
                while i < 30:
                    # 获取本机ip 默认有线地址,有线断开会显示无线
                    pcaddr_new = socket.gethostbyname(
                        socket.getfqdn(socket.gethostname()))
                    print(pcaddr_new, i)
                    if '192.168.' not in str(pcaddr_new):
                        time.sleep(2)
                        i += 1
                    else:
                        print('IP地址已自动获取成功2', i)
                        break
                else:
                    raise Exception('未获取到地址2')
            # 删除黑名单绑定
            login.loginWeb(self)  # admin账号登录
            self.driver.implicitly_wait(10)
            blacklist = Organization_userBlackPage(self.driver, self.url)
            # 打开用户管理 - 组织成员
            blacklist.click_UserManage()
            time.sleep(0.5)
            blacklist.click_blacklist()
            time.sleep(1)
            blacklist.click_delete()
            time.sleep(1)
            blacklist.click_ok()
            time.sleep(1)
            # 断言 开启提示信息是否有误
            listtips = str(blacklist.getText_byXpath(blacklist.list_tips))
            time.sleep(1)
            self.assertEqual(listtips, nodata, msg='黑名单用户删除失败')
            print('黑名单用户已删除')
            self.driver.quit()

        organization_group.import_empty_template(self)  # 判断组织架构是否有其他组 有则清空

        #调用新增组 “SelfComputerTest”
        organization_group.group_add(self)
        time.sleep(1)
        #开启PPPoE认证
        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        pppoeauth = Organization_userAuthPage(self.driver, self.url)
        # 打开用户管理 - 用户认证
        pppoeauth.click_UserManage()
        time.sleep(0.5)
        pppoeauth.click_userAuth()
        time.sleep(1)
        #修改PPPoE服务器配置
        pppoeauth.click_PPPoEConfig()
        time.sleep(2)
        pppoeauth.input_pppoeStart('10.10.10.1')
        pppoeauth.input_pppoePriDns('114.114.114.114')
        pppoeauth.click_PppoeNoticeEn()
        pppoeauth.input_remainDays('50')  #账号到期提前通告时间50天 配合账号将要过期的通告
        pppoeauth.click_save()
        time.sleep(2)
        #启用pppoe server
        pppoeauth.click_pppoeAuthEn()
        time.sleep(1)
        # 断言 开启提示信息是否有误
        status = str(
            pppoeauth.getAttribute_byXpath(pppoeauth.pppoeAuthEns, 'checked'))
        time.sleep(1)
        print(status)
        self.assertEqual(status, 'true', msg='PPPoE认证开启出错')
        print('PPPoE认证开启 验证成功')

        #配置一个不计费的PPPoE账号
        pppoeauth.click_account()
        time.sleep(1)
        pppoeauth.click_addUser()
        time.sleep(1)
        pppoeauth.input_name('pppoeauth')
        #仅有一个用户组,这里省略
        select = pppoeauth.selelement_byName(pppoeauth.authType)
        Select(select).select_by_value('PPPoE')
        time.sleep(1)
        pppoeauth.input_authAccount('pppoeauth')
        pppoeauth.input_authPassword('pppoeauth')
        pppoeauth.click_save()
        time.sleep(2)
        #断言 添加的账号 认证方式和认证账号 是否正常
        list_authtype = pppoeauth.getText_byXpath(pppoeauth.list_authtype)
        list_authAcc = pppoeauth.getText_byXpath(pppoeauth.list_authAcc)
        self.assertEqual(str(list_authtype), 'PPPoE', msg='认证方式显示不为“PPPoE”')
        self.assertEqual(str(list_authAcc),
                         'pppoeauth',
                         msg='认证账号不为“pppoeauth”')

        self.driver.quit()
        logger.info('test_001_openPPPoEAuth_addAcc passed')
示例#8
0
    def test_003_AuthNotice(self):
        u'''账号到期通告'''
        messages = getAssertText('PPPoENotice')

        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        pppoeauth = Organization_userAuthPage(self.driver, self.url)
        # 打开用户管理 - 用户认证
        pppoeauth.click_UserManage()
        time.sleep(0.5)
        pppoeauth.click_userAuth()
        time.sleep(1)
        pppoeauth.click_account()
        time.sleep(1)
        # 新增已过期账号
        pppoeauth.click_addUser()
        time.sleep(1)
        pppoeauth.input_name('BeOverdue')
        selauthType = pppoeauth.selelement_byName('authType')
        Select(selauthType).select_by_value('PPPoE')
        time.sleep(1)
        pppoeauth.input_authAccount('BeOverdue')
        pppoeauth.input_authPassword('BeOverdue')
        pppoeauth.click_accountBillEn()
        time.sleep(1)
        #设置账号日期
        pppoeauth.click_accountOpenDater()
        pppoeauth.click_bnpreMonth()  #向前一个月
        pppoeauth.click_day1()  #任意选择
        pppoeauth.click_accountStopDate()
        pppoeauth.click_bnpreMonth()  # 向前一个月
        pppoeauth.click_day2()
        pppoeauth.click_save()
        time.sleep(2)
        # 断言 添加的账号 认证方式和认证账号 是否正常(第二行)
        list_authtype2 = pppoeauth.getText_byXpath(pppoeauth.list_authtype2)
        list_authAcc2 = pppoeauth.getText_byXpath(pppoeauth.list_authAcc2)
        self.assertEqual(str(list_authtype2), 'PPPoE', msg='认证方式显示不为“PPPoE”')
        self.assertEqual(str(list_authAcc2),
                         'BeOverdue',
                         msg='认证账号不为“BeOverdue”')
        print('认证账号 - 新增已过期账号 成功')

        # 新增将过期账号
        pppoeauth.click_addUser()
        time.sleep(1)
        pppoeauth.input_name('Overdue')
        selauthType = pppoeauth.selelement_byName('authType')
        Select(selauthType).select_by_value('PPPoE')
        time.sleep(1)
        pppoeauth.input_authAccount('Overdue')
        pppoeauth.input_authPassword('Overdue')
        pppoeauth.click_accountBillEn()
        time.sleep(1)
        # 设置账号日期
        pppoeauth.click_accountOpenDater()
        pppoeauth.click_bnpreMonth()  # 向前一个月
        pppoeauth.click_day1()  # 任意选择
        pppoeauth.click_accountStopDate()
        pppoeauth.click_bnpostMonth()  # 向后一个月
        pppoeauth.click_day3()
        pppoeauth.click_save()
        time.sleep(2)
        # 断言 添加的账号 认证方式和认证账号 是否正常(第三行)
        list_authtype3 = pppoeauth.getText_byXpath(pppoeauth.list_authtype3)
        list_authAcc3 = pppoeauth.getText_byXpath(pppoeauth.list_authAcc3)
        self.assertEqual(str(list_authtype3), 'PPPoE', msg='认证方式显示不为“PPPoE”')
        self.assertEqual(str(list_authAcc3),
                         'Overdue',
                         msg='认证账号不为“BeOverdue”')
        print('认证账号 - 新增将过期账号 成功')
        self.driver.quit()

        #开始验证账号到期通告
        # 已过期账号验证
        #开始拨号
        Adsl.connect(self,
                     name='adsl',
                     username='******',
                     password='******')
        # 通过断言IP地址网段,判断是否可以拨号成功
        pcaddr_connectAdsl = socket.gethostbyname(
            socket.getfqdn(socket.gethostname()))
        # print(pcaddr_connectAdsl)
        self.assertIn('10.10.10.', str(pcaddr_connectAdsl), msg='PPPoE拨号失败')
        time.sleep(2)
        # 打开网页测试,测试上网
        self.driver = webdriver.Chrome()
        # self.driver.maximize_window()
        self.driver.implicitly_wait(10)
        self.driver.get('http://www.utt.com.cn')
        time.sleep(2)
        title1 = self.driver.title
        print(title1)
        self.assertEqual(title1, messages, msg='通告未显示')
        time.sleep(1)
        # 拨号挂断,通过断言IP地址网段,判断是否挂断
        Adsl.disconnect(self)
        pcaddr_disconnectAdsl = socket.gethostbyname(
            socket.getfqdn(socket.gethostname()))
        print(pcaddr_disconnectAdsl)
        self.assertIn('192.168.', str(pcaddr_disconnectAdsl), msg='PPPoE挂断失败')
        self.driver.quit()
        print('已过期账号 到期通告 - 验证成功')

        # 将期账号验证
        # 开始拨号
        Adsl.connect(self, name='adsl', username='******', password='******')
        # 通过断言IP地址网段,判断是否可以拨号成功
        pcaddr_connectAdsl = socket.gethostbyname(
            socket.getfqdn(socket.gethostname()))
        # print(pcaddr_connectAdsl)
        self.assertIn('10.10.10.', str(pcaddr_connectAdsl), msg='PPPoE拨号失败')
        # 打开网页测试,测试上网
        self.driver = webdriver.Chrome()
        # self.driver.maximize_window()
        self.driver.implicitly_wait(10)
        self.driver.get('http://www.utt.com.cn')
        time.sleep(2)
        title1 = self.driver.title
        print(title1)
        self.assertEqual(title1, messages, msg='通告未显示')
        time.sleep(1)
        self.driver.get('http://www.baidu.com')
        time.sleep(2)
        title1 = self.driver.title
        print(title1)
        self.assertEqual(title1, baidutitle, msg='第二次打开网页异常')
        time.sleep(1)
        # 拨号挂断,通过断言IP地址网段,判断是否挂断
        Adsl.disconnect(self)
        pcaddr_disconnectAdsl = socket.gethostbyname(
            socket.getfqdn(socket.gethostname()))
        print(pcaddr_disconnectAdsl)
        self.assertIn('192.168.', str(pcaddr_disconnectAdsl), msg='PPPoE挂断失败')
        self.driver.quit()
        print('将过期账号 到期通告 - 验证成功')

        print('账号到期通告 - 验证成功')
        #删除组织架构组(组内的pppoe账号也会一并删掉)
        organization_group.group_delete(self)

        # 关闭pppoe server
        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        pppoeauth = Organization_userAuthPage(self.driver, self.url)
        # 打开用户管理 - 用户认证
        pppoeauth.click_UserManage()
        time.sleep(0.5)
        pppoeauth.click_userAuth()
        time.sleep(1)
        pppoeauth.click_pppoeAuthC()
        time.sleep(1)
        # 断言 开启提示信息是否有误
        status = str(
            pppoeauth.getAttribute_byXpath(pppoeauth.pppoeAuthCs, 'checked'))
        time.sleep(1)
        self.assertEqual(status, 'true', msg='PPPoE认证关闭出错')
        print('PPPoE认证关闭 验证成功')

        self.driver.quit()
        logger.info('test_003_AuthNotice passed')
示例#9
0
    def tearDown(self):
        # 关闭web 认证
        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        self.driver.maximize_window()
        freeauth = Organization_userAuthPage(self.driver, self.url)
        # 打开用户管理 - 用户认证
        freeauth.click_UserManage()
        time.sleep(0.5)
        freeauth.click_userAuth()
        time.sleep(1)
        # 开启web认证
        freeauth.click_WebAuthC()
        time.sleep(1)
        # 断言 提示信息是否有误
        status3 = str(
            freeauth.getAttribute_byXpath(freeauth.WebAuthCs, 'checked'))
        self.assertEqual(status3, 'true', msg='web认证关闭出错')
        print('web认证关闭')
        time.sleep(2)
        # 关闭免认证
        freeauth.click_FreeAuthC()
        time.sleep(1)
        # 断言 提示信息是否有误
        status4 = str(
            freeauth.getAttribute_byXpath(freeauth.FreeAuthCs, 'checked'))
        self.assertEqual(status4, 'true', msg='免认证关闭出错')
        print('免认证关闭')
        self.driver.quit()

        logger.info('tearDown over')
        logger.info('%s' % ('=' * 50))
示例#10
0
    def test_001_add_user(self):
        u'''组织架构 - 新增成员'''
        organization_group.import_empty_template(self)  # 调用判断 有组织架构清空

        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        group = OrganizationMembersPage(self.driver, self.url)
        # 打开用户管理 - 组织成员
        group.click_UserManage()
        time.sleep(0.5)
        group.click_userGroup()
        time.sleep(1)

        #普通用户
        # 获取本机ip 默认有线地址,有线断开会显示无线
        pcaddr = socket.gethostbyname(socket.getfqdn(socket.gethostname()))
        # 新增用户 仅IP 设置的为本机IP
        group.click_addBtnNewTree1()
        time.sleep(1)
        group.input_groupName('SelfComputerTest')
        group.click_save()
        time.sleep(1)
        group.click_addUser()
        time.sleep(1)
        group.input_UserName('SelfComputer1')
        group.input_normalIP(pcaddr)
        group.click_save()
        time.sleep(2)

        # 断言 增加的IP与实际IP相同:代表验证通过
        group.click_userGroup()
        group.click_list_groupName_c()
        time.sleep(1)
        listAddIP = str(group.getText_byXpath(group.listAddIP))
        self.assertEqual(listAddIP, pcaddr, msg='新增 普通用户出错')
        print('组织架构 - 新增普通用户 验证成功')

        # 再新建一个组
        time.sleep(1)
        group.click_addBtnNewTree1()
        time.sleep(1)
        group.input_groupName('SelfComputerTest2')
        group.click_save()
        time.sleep(2)

        #用户认证页面 判断是否支持web认证
        webauth = 1  #预设web和pppoe认证为1,支持
        PPPoEAuth = 1
        auth = Organization_userAuthPage(self.driver, self.url)
        auth.click_userAuth()
        time.sleep(1)
        try:
            self.driver.implicitly_wait(2)
            auth.find_WebAuthC()
        except ElementNotVisibleException:
            webauth = 0
        try:
            auth.find_pppoeAuthC()
        except ElementNotVisibleException:
            PPPoEAuth = 0

        self.driver.implicitly_wait(10)
        group.click_userGroup()
        time.sleep(1)
        if webauth == 1:
            # 新增web认证用户(部分型号不支持web认证)
            group.click_addUser()
            time.sleep(1)
            group.input_UserName('webtest1')
            group.click_authuser()
            time.sleep(1)
            sel = group.selelement_byName(group.authType)
            Select(sel).select_by_value('Web')
            time.sleep(1)
            group.input_authAccount('webtest1')
            group.input_authPassword('webtest1')
            group.click_save()
            time.sleep(2)
            # 断言 添加的账号 认证方式和认证账号 是否正常
            group.click_list_groupName_c()
            time.sleep(1)
            list_authType = group.getText_byXpath(group.list_authType)
            list_authAccount = group.getText_byXpath(group.list_authAccount)
            self.assertEqual(str(list_authType), 'Web', msg='认证方式显示不为“Web”')
            self.assertEqual(str(list_authAccount),
                             'webtest1',
                             msg='认证账号不为“webtest1”')

        if PPPoEAuth == 1:
            #新增pppoe用户(部分型号不支持PPPoE server,目前支持web认证的都支持pppoe server)
            group.click_addUser()
            time.sleep(1)
            group.input_UserName('zpppoetest1')
            group.click_authuser()
            time.sleep(1)
            sel = group.selelement_byName(group.authType)
            Select(sel).select_by_value('PPPoE')
            time.sleep(0.5)
            group.input_authAccount('pppoetest1')
            group.input_authPassword('pppoetest1')
            group.click_save()
            time.sleep(2)
            #断言
            group.click_list_groupName_c()
            time.sleep(1)
            #pppoe账号排序默认在web账号之前的第二行,这里还是判断第二行的信息
            list_authType = group.getText_byXpath(group.list_authType)
            list_authAccount = group.getText_byXpath(group.list_authAccount)
            self.assertEqual(str(list_authType),
                             'PPPoE',
                             msg='认证方式显示不为“PPPoE”')
            self.assertEqual(str(list_authAccount),
                             'pppoetest1',
                             msg='认证账号不为“pppoetest1”')
            print('组织架构 - 新增PPPoE用户 验证成功')

        self.driver.quit()
        logger.info('test_001_add_user passed')
示例#11
0
    def test_002_webAuthTest(self):
        u'''web认证测试'''
        if Support == '√':
            logger.info(u'参数支持本地认证')
            webauthpage = getAssertText('webauthpage')
            webauthsucess = getAssertText('webauthsucess')
            # 新增用户组及认证账号
            # 调用新增组 “SelfComputerTest”
            organization_group.group_add(self)
            time.sleep(1)
            #
            login.loginWeb(self)  # admin账号登录
            self.driver.implicitly_wait(10)
            webauth = Organization_userAuthPage(self.driver, self.url)
            # 打开用户管理 - 用户认证
            webauth.click_UserManage()
            time.sleep(0.5)
            webauth.click_userAuth()
            time.sleep(1)
            webauth.click_account()
            time.sleep(1)
            webauth.click_addUser()
            time.sleep(1)
            webauth.input_name('webtest1')
            # 仅有一个用户组,这里省略
            select = webauth.selelement_byName(webauth.authType)
            Select(select).select_by_value('Web')
            time.sleep(1)
            webauth.input_authAccount('webtest1')
            webauth.input_authPassword('webtest1')
            webauth.click_save()
            time.sleep(2)
            # 断言 添加的账号 认证方式和认证账号 是否正常
            list_authtype = webauth.getText_byXpath(webauth.list_authtype)
            list_authAcc = webauth.getText_byXpath(webauth.list_authAcc)
            self.assertEqual(str(list_authtype), 'Web', msg='认证方式显示不为“Web”')
            self.assertEqual(str(list_authAcc), 'webtest1', msg='认证账号不为“webtest1”')
            self.driver.quit()

            self.driver = webdriver.Chrome()
            # self.driver.maximize_window()
            self.driver.implicitly_wait(10)
            #打开网页测试
            self.driver.get('http://www.utt.com.cn')
            time.sleep(2)
            title1=self.driver.title
            print(title1)
            self.assertEqual(title1, webauthpage, msg='认证页面跳转不正常')

            webauth = Organization_userAuthPage(self.driver, self.url)
            webauth.input_userName('webtest1')
            webauth.input_userPasswd('webtest1')
            webauth.click_loginbtn()
            time.sleep(2)
            title2 = self.driver.title
            print(title2)
            self.assertEqual(title2, webauthsucess, msg='不能认证成功')

            self.driver.get('http://www.baidu.com')
            time.sleep(2)
            title3 = self.driver.title
            print(title3)
            self.assertEqual(title3, '百度一下,你就知道', msg='认证后 不能打开网页')
            self.driver.quit()
        elif Support == '×':
            logger.info(u'参数不支持本地认证')
        logger.info('test_002_webAuthTest passed')
示例#12
0
    def test_002_FreeAuthIP(self):
        u'''免认证 - IP地址'''
        pcaddr = socket.gethostbyname(socket.getfqdn(
            socket.gethostname()))  # 获取本机ip 默认有线地址
        # 免认证选择IP地址
        time.sleep(2)
        freeauth = Organization_userAuthPage(self.driver, self.url)
        freeauth.click_noConfig()
        time.sleep(1)
        freeauth.click_userip()
        time.sleep(1)
        freeauth.input_starip(pcaddr)
        freeauth.input_endip(pcaddr)
        freeauth.click_save()
        time.sleep(5)
        self.driver.quit()

        # 打开网页验证 断言
        self.driver = webdriver.Chrome()
        self.driver.get('http://www.baidu.com')
        time.sleep(2)
        title1 = self.driver.title
        # print(title1)
        self.assertEqual(title1, '百度一下,你就知道', msg='免认证-IP地址 出错')
        self.driver.quit()
        logger.info('test_002_FreeAuthIP passed')
示例#13
0
    def test_001_FreeAuthgroup(self):
        u'''免认证 - 组织成员'''
        self.driver.quit()

        organization_group.import_empty_template(self)  # 判断组织架构是否有其他组 有则清空

        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        freeauth = Organization_userAuthPage(self.driver, self.url)
        # 打开用户管理 - 用户认证
        freeauth.click_UserManage()
        time.sleep(0.5)
        freeauth.click_userAuth()
        time.sleep(1)
        #免认证选择组织架构
        freeauth.click_noConfig()
        time.sleep(1)
        freeauth.click_usergroup()
        time.sleep(1)
        # 组织架构,这里选择的是ROOT 所有
        freeauth.click_Root()
        time.sleep(0.5)
        freeauth.click_save()
        time.sleep(1)
        self.driver.quit()

        # 新增用户组及普通IP用户
        organization_group.add_user(self)

        #打开网页验证 断言
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(10)
        self.driver.get('http://www.baidu.com')
        time.sleep(2)
        title1 = self.driver.title
        # print(title1)
        self.assertEqual(title1, '百度一下,你就知道', msg='免认证-组织架构 出错')
        self.driver.quit()
        print('免认证 - 组织成员 验证成功')

        #导入空组织架构 以 清空
        organization_group.import_empty_template(self)
        logger.info('test_001_FreeAuthgroup passed')
示例#14
0
 def setUp(self):
     logger.info('setUp start')
     #开启web 认证
     login.loginWeb(self)  # admin账号登录
     self.driver.implicitly_wait(10)
     self.driver.maximize_window()
     freeauth = Organization_userAuthPage(self.driver, self.url)
     # 打开用户管理 - 用户认证
     freeauth.click_UserManage()
     time.sleep(0.5)
     freeauth.click_userAuth()
     time.sleep(1)
     # 开启web认证
     freeauth.click_WebAuthEn()
     time.sleep(0.5)
     # 断言 提示信息是否有误
     status1 = str(
         freeauth.getAttribute_byXpath(freeauth.WebAuthEs, 'checked'))
     self.assertEqual(status1, 'true', msg='web认证开启出错')
     print('web认证开启')
     time.sleep(1)
     #开启免认证
     freeauth.click_FreeAuthEn()
     time.sleep(0.5)
     # 断言 提示信息是否有误
     status2 = str(
         freeauth.getAttribute_byXpath(freeauth.FreeAuthEs, 'checked'))
     self.assertEqual(status2, 'true', msg='免认证开启出错')
     print('免认证开启')
    def test_005_RemoteAuth(self):
        u'''远程认证(某些设备可能不支持)'''
        remoteAuthP = getParameter('remoteAuthP')
        Support = getExcelValue(remoteAuthP)
        remoteauth = Organization_userAuthPage(self.driver, self.url)
        remoteauth.click_userAuth()
        time.sleep(1)
        if Support == '√':
            logger.info(u'参数支持远程认证')
            try:
                self.driver.implicitly_wait(2)
                remoteauth.click_remoteConfig()
            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)
                #判断没有无流量下线
                try:
                    self.driver.implicitly_wait(2)
                    remoteauth.find_wllxxsj()
                except ElementNotVisibleException:
                    pass
                except ElementNotInteractableException:
                    pass
                else:
                    raise Exception('远程认证界面存在无流量下线')
                #域名名称
                remoteauth.click_ymmc()
                # 白名单列表
                remoteauth.click_bmdlb()
        elif Support == '×':
            logger.info(u'参数不支持远程认证')
            try:
                self.driver.implicitly_wait(2)
                remoteauth.click_remoteConfig()
            except AttributeError or NoSuchElementException:
                logger.info(u'软件不支持远程认证,与参数表相符')
            else:
                CapPic(self.driver)
                logger.info(u'软件支持远程认证,与参数表不符')
                raise Exception(u'软件支持远程认证,与参数表不符')
        else:
            logger.info(u'参数表读取异常')
            logger.info(u'参数表读取值为:', Support)
            raise Exception(u'参数表读取异常')

        self.driver.quit()
        logger.info('test_005_RemoteAuth passed')
    def test_001_UserStatistics(self):
        u'''用户统计(某些型号不支持建立pppoe账号)'''
        tempUser = getAssertText('tempUser')
        Minute = getAssertText('minute')
        Ban = getAssertText('Ban')
        pppoeSp = getParameter('pppoeSp')
        SupportP = getExcelValue(pppoeSp)
        webAutnp = getParameter('webAutnp')
        SupportW = getExcelValue(webAutnp)

        userstatus = Organization_userStatusPage(self.driver, self.url)
        userstatus.click_userstatus()
        time.sleep(1)
        # 将页面刷新按钮改成“手动”
        selmanual = userstatus.selelement_byXpath(userstatus.selmanual)
        Select(selmanual).select_by_value('3')
        time.sleep(0.3)
        Select(selmanual).select_by_value('5')
        time.sleep(0.3)
        Select(selmanual).select_by_value('10')
        time.sleep(0.3)
        Select(selmanual).select_by_value('60')
        time.sleep(0.3)
        Select(selmanual).select_by_value('manual')
        time.sleep(0.3)
        userstatus.click_refreshtable()
        time.sleep(1)
        #右上角移动、加入黑名单按钮
        userstatus.find_move()
        userstatus.find_addToBlackList()
        # 定义页面显示元素变量
        ID = str(userstatus.getText_byXpath(userstatus.ID))
        username = str(userstatus.getText_byXpath(userstatus.username))
        group = str(userstatus.getText_byXpath(userstatus.group))
        VlanID = str(userstatus.getText_byXpath(userstatus.VlanID))
        IP = str(userstatus.getText_byXpath(userstatus.IP))
        mac = str(userstatus.getText_byXpath(userstatus.mac))
        authmode = str(userstatus.getText_byXpath(userstatus.authmode))
        online_time_length = str(
            userstatus.getText_byXpath(userstatus.online_time_length))
        Uploading_data = str(
            userstatus.getText_byXpath(userstatus.Uploading_data))
        Downing_data = str(userstatus.getText_byXpath(userstatus.Downing_data))
        Uploading_speed = str(
            userstatus.getText_byXpath(userstatus.Uploading_speed))
        Downing_speed = str(
            userstatus.getText_byXpath(userstatus.Downing_speed))
        edit = str(userstatus.getText_byXpath(userstatus.edit))

        # 断言 用户列表是否显示有误
        time.sleep(1)
        self.assertEqual(ID, '1', msg='ID出错')
        print('用户状态 - ID 验证成功')
        self.assertIsNotNone(username, msg='用户名 出错')
        print('用户状态 - 用户名 验证成功')
        self.assertEqual(group, tempUser,
                         msg='所属组 出错')  # 脚本在最后会清空组织架构,所以脚本在一开始新建组,用户都是 临时用户
        print('用户状态 - 所属组 验证成功')
        self.assertIsNotNone(VlanID, msg='VLANID 出错')
        print('用户状态 - VLANID 验证成功')
        self.assertIn('192.168.', IP, msg='IP 出错')  # lan口地址段
        print('用户状态 - IP 验证成功')
        self.assertEqual(len(mac), 17, msg='mac 出错')  # 判断mac地址长度
        print('用户状态 - mac 验证成功')
        self.assertIsNotNone(authmode, msg='认证方式 出错')
        print('用户状态 - 认证方式 验证成功')
        self.assertIn(Minute, online_time_length, msg='在线时长 出错')  # 在线时长是否包含“分”
        print('用户状态 - 在线时长 验证成功')
        self.assertIsNotNone(Uploading_data, msg='上传数据 出错')
        print('用户状态 - 上传数据 验证成功')
        self.assertIsNotNone(Downing_data, msg='下载数据 出错')
        print('用户状态 - 下载数据 验证成功')
        self.assertIsNotNone(Uploading_speed, msg='上传速度 出错')
        print('用户状态 - 上传速度 验证成功')
        self.assertIsNotNone(Downing_speed, msg='下载速度 出错')
        print('用户状态 - 下载速度 验证成功')
        self.assertEqual(edit, Ban, msg='拉黑菜单显示 出错')
        print('用户状态 - 拉黑菜单显示 验证成功')

        userauth = Organization_userAuthPage(self.driver, self.url)
        userauth.click_userAuth()
        time.sleep(1)
        userauth.click_account()
        time.sleep(2)
        userauth.click_addUser()
        time.sleep(1)
        selauthType = userauth.selelement_byName(userauth.authType)
        if SupportW == '√':
            try:
                self.driver.implicitly_wait(2)
                Select(selauthType).select_by_value('Web')
            except NoSuchElementException:
                raise Exception('认证账号中不能选择web类型')
        elif SupportW == '×':
            try:
                self.driver.implicitly_wait(2)
                Select(selauthType).select_by_value('Web')
            except NoSuchElementException:
                logger.info(u'认证账号中不能选择web类型,与参数表相符')
            else:
                CapPic(self.driver)
                logger.info(u'认证账号中能选择web类型,与参数表不相符')
                raise Exception('认证账号中能选择web类型,与参数表不相符')
        else:
            logger.info(u'web参数表读取异常')
            logger.info(u'web参数表读取值为:', SupportW)
            raise Exception(u'web参数表读取异常')
        time.sleep(0.3)
        if SupportP != '×':
            try:
                self.driver.implicitly_wait(2)
                Select(selauthType).select_by_value('PPPoE')
            except NoSuchElementException:
                raise Exception('认证账号中不能选择pppoe类型')
        elif SupportP == '×':
            try:
                self.driver.implicitly_wait(2)
                Select(selauthType).select_by_value('PPPoE')
            except NoSuchElementException:
                logger.info(u'认证账号中不能选择pppoe类型,与参数表相符')
            else:
                CapPic(self.driver)
                logger.info(u'认证账号中能选择pppoe类型,与参数表不相符')
                raise Exception('认证账号中能选择pppoe类型,与参数表不相符')
        else:
            logger.info(u'pppoe参数表读取异常')
            logger.info(u'pppoe参数表读取值为:', SupportP)
            raise Exception(u'pppoe参数表读取异常')
        time.sleep(0.3)
        self.driver.implicitly_wait(10)

        self.driver.quit()
        logger.info('test_001_UserStatistics passed')
示例#17
0
 def test_003_delAccNumber(self):
     u'''认证账号 - 删除'''
     nodata = getAssertText('nodata')
     login.loginWeb(self)  # admin账号登录
     self.driver.implicitly_wait(10)
     pppoeauth = Organization_userAuthPage(self.driver, self.url)
     # 打开用户管理 - 用户认证
     pppoeauth.click_UserManage()
     time.sleep(0.5)
     pppoeauth.click_userAuth()
     time.sleep(1)
     pppoeauth.click_account()
     time.sleep(1)
     pppoeauth.click_selAll()
     time.sleep(0.5)
     pppoeauth.click_deleteAll()
     time.sleep(1)
     pppoeauth.click_ok()
     time.sleep(1)
     list_tips=pppoeauth.getText_byXpath(pppoeauth.list_tips)
     self.assertEqual(str(list_tips),nodata,msg='账号删除失败')
     print('认证账号 - 账号删除 验证通过')
     self.driver.quit()
     organization_group.group_delete(self)  # 删除组
     logger.info('test_003_delAccNumber passed')
示例#18
0
    def test_003_closeRemoteAuth(self):
        u'''关闭远程认证'''
        if Support == '√':
            logger.info(u'参数支持远程认证')
            login.loginWeb(self)  # admin账号登录
            self.driver.implicitly_wait(10)
            remoteauth = Organization_userAuthPage(self.driver, self.url)
            remoteauth.click_UserManage()
            time.sleep(0.3)
            remoteauth.click_userAuth()
            time.sleep(1)
            # 关闭web认证
            remoteauth.click_remoteAuthC()
            time.sleep(1)
            # 断言 提示信息是否有误
            status = str(
                remoteauth.getAttribute_byXpath(remoteauth.remoteAuthCs,
                                                'checked'))
            self.assertEqual(status, 'true', msg='远程认证关闭出错')
            print('远程认证关闭')
            # 免认证选择 全部用户,然后关闭免认证
            remoteauth.click_noConfig()
            time.sleep(1)
            remoteauth.click_alluser()
            time.sleep(0.5)
            remoteauth.click_save()
            time.sleep(1)
            remoteauth.click_FreeAuthC()
            time.sleep(2)
            # 断言 提示信息是否有误
            status2 = str(
                remoteauth.getAttribute_byXpath(remoteauth.FreeAuthCs,
                                                'checked'))
            self.assertEqual(status2, 'true', msg='免认证关闭出错')
            print('免认证关闭')
            self.driver.quit()

            # 清空组织架构组
            organization_group.import_empty_template(self)  # 判断组织架构是否有其他组 有则清空
            print('删除组织架构组 完成')
        elif Support == '×':
            logger.info(u'参数不支持远程认证')
        logger.info('test_003_closeRemoteAuth passed')
示例#19
0
    def test_001_addWebAccNumber(self):
        u'''认证账号 - web账号'''
        AccountingType = getAssertText('AccountingType')
        organization_group.import_empty_template(self)  # 判断组织架构是否有其他组 有则清空
        # 调用新增组 “SelfComputerTest”
        organization_group.group_add(self)

        # 新增web认证账号
        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        webauth = Organization_userAuthPage(self.driver, self.url)
        # 打开用户管理 - 用户认证
        webauth.click_UserManage()
        time.sleep(0.5)
        webauth.click_userAuth()
        time.sleep(1)
        webauth.click_account()
        time.sleep(1)
        webauth.click_addUser()
        time.sleep(1)
        webauth.input_name('webtest1')
        # 仅有一个用户组,这里省略
        select = webauth.selelement_byName(webauth.authType)
        Select(select).select_by_value('Web')
        time.sleep(1)
        webauth.input_authAccount('webtest1')
        webauth.input_authPassword('webtest1')
        webauth.click_save()
        time.sleep(2)
        # 断言 添加的账号 认证方式和认证账号 是否正常
        list_authtype = webauth.getText_byXpath(webauth.list_authtype)
        list_authAcc = webauth.getText_byXpath(webauth.list_authAcc)
        self.assertEqual(str(list_authtype), 'Web', msg='认证方式显示不为“Web”')
        self.assertEqual(str(list_authAcc), 'webtest1', msg='认证账号不为“webtest1”')
        print('认证账号 - 新增web账号 验证成功')

        # 修改web账号的计费方式为日期计费
        time.sleep(1)
        webauth.click_listedit1()
        time.sleep(1)
        webauth.click_accountBillEn()
        time.sleep(0.5)
        webauth.click_save()
        time.sleep(1)
        # 断言 编辑的账号 计费方式是否已开启
        list_AccountingType = str(webauth.getText_byXpath(webauth.list_AccountingType))
        self.assertEqual(list_AccountingType, AccountingType, msg='web认证账号 修改成功')
        self.driver.quit()
        logger.info('test_001_addWebAccNumber passed')
示例#20
0
    def test_002_remoteAuth_FreeAuth(self):
        u'''认证弹窗测试&&免认证测试'''
        if Support == '√':
            logger.info(u'参数支持远程认证')
            saveSucess = getAssertText('saveSucess')

            self.driver = webdriver.Chrome()
            # self.driver.maximize_window()
            self.driver.implicitly_wait(10)
            #打开网页测试
            self.driver.get('http://www.utt.com.cn')
            time.sleep(2)
            title1 = self.driver.title
            now_url = self.driver.current_url
            print(title1, now_url)
            # self.assertEqual(title1, '艾泰科技', msg='认证页面跳转不正常') 如
            self.assertIn('http://auth.greenwifi.com.cn',
                          now_url,
                          msg='认证页面跳转不正常')
            self.driver.quit()
            print('远程认证 弹窗验证成功')

            #打开组织架构的免认证
            login.loginWeb(self)  # admin账号登录
            self.driver.implicitly_wait(10)
            remoteauth = Organization_userAuthPage(self.driver, self.url)
            remoteauth.click_UserManage()
            time.sleep(0.3)
            remoteauth.click_userAuth()
            time.sleep(1)
            # 免认证选择组织架构
            remoteauth.click_noConfig()
            time.sleep(1)
            remoteauth.click_usergroup()
            time.sleep(1)
            # 组织架构,这里选择的是ROOT 所有
            remoteauth.click_Root()
            time.sleep(0.5)
            remoteauth.click_save()
            time.sleep(1)
            # 开启免认证
            remoteauth.click_FreeAuthEn()
            time.sleep(2)
            # 断言 提示信息是否有误
            pageTip = str(remoteauth.getText_byClass(remoteauth.pageTip))
            time.sleep(1)
            self.assertEqual(pageTip, saveSucess, msg='免认证开启出错')
            self.driver.quit()
            print('免认证开启')

            # 打开网页测试
            time.sleep(5)
            self.driver = webdriver.Chrome()
            # self.driver.maximize_window()
            self.driver.implicitly_wait(10)
            self.driver.get('http://www.baidu.com')
            time.sleep(2)
            title3 = self.driver.title
            print(title3)
            self.assertEqual(title3, '百度一下,你就知道', msg='开启免认证后 不能直接打开网页')
            self.driver.quit()
        elif Support == '×':
            logger.info(u'参数不支持远程认证')
        logger.info('test_002_remoteAuth_FreeAuth passed')
示例#21
0
    def test_002_addpppoeAccNumber(self):
        u'''认证账号 - PPPoE账号(部分型号不支持PPPoE server)'''
        bindingMode = getAssertText('bindingMode')
        # 开启PPPoE认证
        login.loginWeb(self)  # admin账号登录
        self.driver.implicitly_wait(10)
        pppoeauth = Organization_userAuthPage(self.driver, self.url)
        # 打开用户管理 - 用户认证
        pppoeauth.click_UserManage()
        time.sleep(0.5)
        pppoeauth.click_userAuth()
        time.sleep(1)
        # 新增pppoe认证账号
        pppoeauth.click_account()
        time.sleep(1)
        pppoeauth.click_addUser()
        time.sleep(1)
        pppoeauth.input_name('pppoetest1')
        # 仅有一个用户组,这里省略
        select = pppoeauth.selelement_byName(pppoeauth.authType)
        Select(select).select_by_value('PPPoE')
        time.sleep(1)
        pppoeauth.input_authAccount('pppoetest1')
        pppoeauth.input_authPassword('pppoetest1')
        pppoeauth.click_save()
        time.sleep(2)
        # 断言 添加的账号 认证方式和认证账号 是否正常
        list_authtype = pppoeauth.getText_byXpath(pppoeauth.list_authtype)
        list_authAcc = pppoeauth.getText_byXpath(pppoeauth.list_authAcc)
        self.assertEqual(str(list_authtype), 'PPPoE', msg='认证方式显示不为“PPPoE”')
        self.assertEqual(str(list_authAcc), 'pppoetest1', msg='认证账号不为“pppoetest1”')
        print('认证账号 - 新增PPPoE用户 验证成功')

        # 修改pppoe账号的绑定模式为自动绑定
        time.sleep(1)
        pppoeauth.click_listedit1()
        time.sleep(1)
        pppoeauth.click_autoBind()
        time.sleep(0.5)
        pppoeauth.click_save()
        time.sleep(2)
        # 断言 编辑的账号 绑定模式是否为自动绑定
        binding_mode = pppoeauth.getText_byXpath(pppoeauth.list_bindingMode)
        self.assertEqual(str(binding_mode), bindingMode, msg='pppoe账号 修改成功')
        self.driver.quit()
        logger.info('test_002_addpppoeAccNumber passed')