Пример #1
0
    def test_wrongpassword(self):
        """无线密码错误,提示语检查"""
        L.info("test_wrongpassword START:错误的无线密码,提示信息检查")
        driver = self.driver
        print("caseid:040")
        driver.get(self.baseurl)
        login(driver)
        time.sleep(2)
        driver.find_element_by_id("wirless").click()
        time.sleep(1)
        wifipassword=["ee","hello world","你好"]
        for i in wifipassword:
            driver.find_element_by_id('password1_24').clear()

            driver.find_element_by_id('password1_24').send_keys(i)
            time.sleep(5)
            driver.find_element_by_xpath("//input[@id='savebutton']").click()
            # driver.find_element_by_id('savebutton').click()
            time.sleep(2)
            if driver.find_element_by_id("errorinfo_2").is_displayed():
                errorinfo=driver.find_element_by_id("errorinfo_2").text
                if (errorinfo=="2.4G无线密码不能包含空格,请重新输入。" )or\
                        (errorinfo=="2.4G无线密码长度错误,请输入8至63个字符。")\
                        or (errorinfo=="2.4G无线密码中存在非法字符,请重新输入。"):
                    result=True

                else:
                    result = False
            self.assertTrue(result)
        L.info("test_wrongpassword STOP")
Пример #2
0
    def test_endlaniperror(self):
        """结束ip地址非法,提示信息检查"""
        L.info("test_endlaniperror START:结束ip地址非法,提示信息检查")
        driver = self.driver
        print("caseid:007")
        try:
            login(driver)
        except e.NoSuchElementException:
            L.info("登录系统失败")
            L.error(traceback.format_exc())

        time.sleep(2)
        driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
        driver.find_element_by_id("lang_dhcpsever").click()
        time.sleep(3)
        driver.find_element_by_id("startLanIp").clear()
        driver.find_element_by_id("startLanIp").send_keys("2")
        driver.find_element_by_id("endLanIp").clear()
        driver.find_element_by_id("endLanIp").send_keys("255")
        driver.find_element_by_id("savebutton5").click()
        time.sleep(1)
        errorinfo2 = driver.find_element_by_id("errorinfo_2")
        result = True
        try:
            if errorinfo2.is_displayed():
                self.assertEqual(errorinfo2.text, "地址池结束值错误,请重新输入。")
            else:
                result = False
        except e.NoSuchElementException:
            L.error(traceback.format_exc())
        self.assertTrue(result)
        L.info("test_endlaniperror STOP")
Пример #3
0
 def test_gotowan(self):
     """能否正确跳转"""
     L.info("test_gotowan START:测试能否正确跳转到互联网设置页面")
     driver = self.driver
     print("caseid:027")
     driver.get(self.baseurl)
     login(driver)
     driver.implicitly_wait(30)
     driver.find_element_by_xpath(
         "//div[@id='want_internet_id']/div/span").click()
     self.assertEqual(driver.current_url, "http://192.168.0.1/Network.html")
     L.info("test_gotowan STOP")
Пример #4
0
 def test_gotowifi(self):
     """是否可以成功跳转到无线设置页面"""
     L.info("test_gotowifi START:是否可以成功跳转到无线设置页面")
     driver = self.driver
     print("caseid:035")
     driver.get(self.baseurl)
     login(driver)
     time.sleep(2)
     driver.find_element_by_id("wirless").click()
     time.sleep(1)
     currenturl=driver.current_url
     self.assertEqual(currenturl,"http://192.168.0.1/Wireless.html")
     L.info("test_gotowifi STOP")
Пример #5
0
 def test_reboot(self):
     """重启功能检查,重启后,进入登录页"""
     L.info("test_reboot START:重启功能检查")
     driver = self.driver
     print("caseid:024")
     uploadpng = self.uploadpng
     driver.get(self.baseurl)
     login(driver)
     driver.implicitly_wait(3)
     try:
         driver.find_element_by_xpath(
             "//div[@id='want_more_id']/div").click()
         time.sleep(1)
         driver.find_element_by_id("ic_systemSetup").click()
         time.sleep(2)
         driver.find_element_by_id("lang_reboot").click()
         time.sleep(5)
         driver.find_element_by_id("btn_reboot_router").click()
     except e.NoSuchElementException:
         L.error(traceback.format_exc())
     try:
         driver.find_element_by_id("btn_reboot_confirm").click()
         WebDriverWait(driver, 120).until(
             EC.invisibility_of_element_located((By.ID, "DeviceRebooting")))
         time.sleep(3)
         self.assertEqual(driver.current_url,
                          "http://192.168.0.1/Login.html")
     except e.NoSuchElementException:
         L.error(traceback.format_exc())
     L.info("test_reboot STOP")
Пример #6
0
    def test_wifipasswordright(self):
        """格式正确的wifi 密码输入后是否可以成功保存"""
        L.info("test_wifipasswordright START:格式正确的wifi 密码输入后是否可以成功保存")
        driver = self.driver
        print("caseid:041")
        driver.get(self.baseurl)
        login(driver)
        time.sleep(2)
        driver.find_element_by_id("wirless").click()
        time.sleep(1)
        result=0
        wifipassword = ["werwerwer", ":#$@Q#$@Q#$@Q","@!$as@!$as@!$as","@#$12@#$12","!@#$%^a!","iot123321"]
        for i in wifipassword:
            time.sleep(2)
            driver.find_element_by_id('password1_24').clear()
            driver.find_element_by_id('password1_24').send_keys(i)
            time.sleep(5)
            driver.find_element_by_xpath("//input[@id='savebutton']").click()
            try:

                driver.find_element_by_id("saveconfirm2_5G").click()
                WebDriverWait(driver, 40).until(
                    EC.invisibility_of_element_located((By.ID, "CreatePopAlertMessage"))
                )
                js = "document.getElementById('password1_24').value;"
                t = driver.execute_script(js)
                if t==i:
                    result+=1
                else:
                    L.info("未保存成功")
            except NoSuchElementException:
                L.info(traceback.format_exc())
        self.assertEqual(len(wifipassword), result, "目前失败的原因是input 元素取不到值")
        L.info("test_wifipasswordright STOP")
Пример #7
0
    def test_firwareupdate(self):
        """固件格式错误时提示信息检查"""
        L.info("test_firwareupdate START:固件格式错误时提示信息检查")
        #固件格式错误时提示信息检查,由于目前没有正确的固件,固件升级中暂时只做一个用例,后续完善
        driver = self.driver
        print("caseid:023")
        uploadpng = self.uploadpng
        driver.get(self.baseurl)
        login(driver)
        driver.implicitly_wait(2)
        driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
        time.sleep(1)
        driver.find_element_by_id("ic_systemSetup").click()
        time.sleep(3)
        driver.find_element_by_id("lang_upgrade").click()
        time.sleep(5)
        driver.find_element_by_css_selector('label.styled_button_s').click()
        time.sleep(5)
        cmd = "./upgrade/upload.exe" + " " + uploadpng
        print(cmd)

        #调用autoit脚本选择文件
        L.info("开始用autoit3脚本控制选择本地文件")
        ps = subprocess.Popen(cmd)
        ps.wait()
        time.sleep(10)
        try:
            driver.find_element_by_id("btn_begin_upload").click()

            if (driver.find_element_by_id("errorinfo_update").is_displayed()):
                errorinfo = driver.find_element_by_id("errorinfo_update").text
                self.assertEqual(errorinfo, "文件类型错误,应选择*.bin或*.img。")
        except e.ElementNotVisibleException:
            L.error(traceback.format_exc())
        L.info("test_firwareupdate STOP")
Пример #8
0
 def test_login_right(self):
     """正确的密码登录"""
     L.info("test_login_right START:输入正确的密码验证是否能成功登录")
     driver=self.driver
     print("caseid:012")
     rightpassword=self.rightpassword
     driver.get(self.baseurl)
     L.info(driver.title)
     L.info("未登录之前的URL: %s"% driver.current_url)
     driver.find_element_by_id("admin_Password1").send_keys(rightpassword)
     driver.find_element_by_id("logIn_btn").click()
     time.sleep(5)
     loginurl=driver.current_url
     L.info("登录成功后的URL:%s" %loginurl)
     expecturl='http://192.168.0.1/Home.html'
     self.assertEqual(loginurl,expecturl)
     L.info("test_login_right STOP")
Пример #9
0
 def test_nowifiname(self):
     """不填写无线用户时的提示信息检查"""
     L.info("test_nowifiname START:不填写无线用户时的提示信息检查")
     driver = self.driver
     print("caseid:038")
     driver.get(self.baseurl)
     login(driver)
     time.sleep(2)
     driver.find_element_by_id("wirless").click()
     time.sleep(3)
     driver.find_element_by_id('wifiName_24').clear()
     driver.find_element_by_xpath("//input[@id='savebutton']").click()
     result=True
     if driver.find_element_by_id("errorinfo_1").is_displayed():
         self.assertEqual("请输入2.4G无线名称。",driver.find_element_by_id("errorinfo_1").text)
     else:
         result=False
     self.assertTrue(result)
     L.info("test_nowifiname STOP")
Пример #10
0
 def test_dhcpclose(self):
     """关闭 dhcp 功能检查"""
     L.info("test_dhcpclose START:关闭dhcp功能,检查页面租期和范围不展示")
     driver = self.driver
     print("caseid:010")
     driver.get(self.baseurl)
     login(driver)
     time.sleep(2)
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     driver.find_element_by_id("lang_dhcpsever").click()
     time.sleep(1)
     driver.find_element_by_id("dhcp_statue").click()
     result=True
     if not driver.find_element_by_id("dhcppool").is_displayed():
         self.assertTrue(result)
     else :
         result=False
         self.assertTrue(result)
     #driver.find_element_by_id("savebutton5").click()
     L.info("test_dhcpclose STOP")
Пример #11
0
    def test_noip(self):
        """不填入IP地址"""
        L.info("test_noip START:不输入IP地址,提示语检查")
        driver = self.driver
        print("caseid:028")
        driver.get(self.baseurl)
        login(driver)
        driver.implicitly_wait(30)
        driver.find_element_by_xpath(
            "//div[@id='want_internet_id']/div/span").click()
        time.sleep(5)
        js = 'document.querySelectorAll("select")[0].style.display="block";'
        driver.execute_script(js)

        select = Select(driver.find_element_by_name('select_networktype'))
        select.select_by_value('Static')
        driver.find_element_by_id("savebutton").click()
        self.assertEqual(
            driver.find_element_by_id("errorinfo_4").text, "请输入IP地址。")
        L.info("test_noip STOP")
Пример #12
0
    def test_timezone(self):
        """切换时区后的检查"""
        L.info("test_time START:切换时区后的检查")
        driver = self.driver
        print("caseid:022")
        driver.get(self.baseurl)
        login(driver)
        driver.implicitly_wait(30)
        driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
        time.sleep(1)
        driver.find_element_by_id("ic_systemSetup").click()
        time.sleep(3)
        driver.find_element_by_id("lang_time").click()
        select = Select(driver.find_element_by_id("select_zone"))
        time.sleep(2)
        js = 'document.querySelectorAll("select")[0].style.display="block";'
        driver.execute_script(js)
        select.select_by_value("CST+7")
        driver.find_element_by_id("savebutton5").click()

        WebDriverWait(driver, 20).until(
            EC.invisibility_of_element_located((By.ID, "CreateOnloadMessage")))
        time.sleep(3)
        selecttext = driver.find_element_by_class_name('sbSelector').text
        self.assertEqual(selecttext, "CST+7 (MST-北美山区标准时间)")
        #测试完毕,恢复到正确时区
        select1 = Select(driver.find_element_by_id("select_zone"))
        time.sleep(2)
        js = 'document.querySelectorAll("select")[0].style.display="block";'
        driver.execute_script(js)
        time.sleep(2)
        select1.select_by_value("CST-8")
        time.sleep(2)
        driver.find_element_by_id("savebutton5").click()
        time.sleep(2)
        WebDriverWait(driver, 30).until(
            EC.invisibility_of_element_located((By.ID, "CreateOnloadMessage")))
        self.assertEqual(
            driver.find_element_by_class_name('sbSelector').text,
            "CST-8 (EAT-北京,重庆,香港特别行政区,乌鲁木齐)")
        L.info("test_time STOP")
Пример #13
0
    def test_noconfirmpassword(self):
        """确认密码不填写时的提示信息检查"""

        L.info("test_noconfirmpassword START:确认密码不填写时的提示信息检查")
        driver = self.driver
        print("caseid:017")
        currpassword = self.currpassword
        newpassword = self.newpassword
        driver.get(self.baseurl)
        login(driver)
        driver.implicitly_wait(30)
        driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
        time.sleep(1)
        driver.find_element_by_id("ic_systemSetup").click()
        time.sleep(3)
        driver.find_element_by_xpath("//li[@id='liaccount']/a").click()
        driver.find_element_by_id("current_password").send_keys(currpassword)
        driver.find_element_by_id("new_password").send_keys(newpassword)
        time.sleep(5)
        driver.find_element_by_id("savebutton5").click()
        try:
            if (driver.find_element_by_id("errorinfo_3").is_displayed()):
                errorinfo = driver.find_element_by_id("errorinfo_3").text
                self.assertEqual(errorinfo, "请输入确认密码。")
        except e.NoSuchElementException:
            L.info(traceback.format_exc())
        L.info("test_noconfirmpassword STOP")
Пример #14
0
 def test_startipbigger(self):
     """开始ip地址大于结束ip地址"""
     L.info("test_startipbigger START:开始ip地址大于结束ip地址,提示信息检查")
     driver = self.driver
     print("caseid:008")
     driver.get(self.baseurl)
     login(driver)
     time.sleep(2)
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     driver.find_element_by_id("lang_dhcpsever").click()
     time.sleep(3)
     driver.find_element_by_id("startLanIp").clear()
     driver.find_element_by_id("startLanIp").send_keys("234")
     driver.find_element_by_id("endLanIp").clear()
     driver.find_element_by_id("endLanIp").send_keys("12")
     driver.find_element_by_id("savebutton5").click()
     time.sleep(1)
     errorinfo2 = driver.find_element_by_id("errorinfo_2")
     result = True
     try:
         if errorinfo2.is_displayed():
             self.assertEqual(errorinfo2.text, "地址池结束值不能小于开始值,请重新输入。")
         else:
             result = False
     except e.NoSuchElementException:
         L.error(traceback.format_exc())
     self.assertTrue(result)
     L.info("test_startipbigger STOP")
Пример #15
0
 def test_newpassworderror(self):
     """新密码格式错误时的,提示信息检查"""
     L.info("newpassworderror START:新密码格式错误时的,提示信息检查")
     driver = self.driver
     print("caseid:020")
     currpassword = self.currpassword
     driver.get(self.baseurl)
     login(driver)
     driver.implicitly_wait(30)
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     time.sleep(1)
     driver.find_element_by_id("ic_systemSetup").click()
     time.sleep(3)
     driver.find_element_by_xpath("//li[@id='liaccount']/a").click()
     driver.find_element_by_id("current_password").send_keys(currpassword)
     driver.find_element_by_id("new_password").send_keys("123")
     time.sleep(3)
     driver.find_element_by_id("savebutton5").click()
     try:
         if (driver.find_element_by_id("errorinfo_2").is_displayed()):
             errorinfo = driver.find_element_by_id("errorinfo_2").text
             self.assertEqual(errorinfo, "新密码长度不正确,请输入8至63个字符。")
     except e.NoSuchElementException:
         L.error(traceback.format_exc())
     L.info("newpassworderror START")
Пример #16
0
    def test_nogateway(self):
        """不输入默认网关时的提示信息检查"""
        L.info("test_nogateway START:不输入默认网关时的提示信息检查")
        driver = self.driver
        print("caseid:031")
        ip = self.ipaddress
        mask = self.mask
        driver.get(self.baseurl)
        login(driver)
        driver.implicitly_wait(30)
        driver.find_element_by_xpath(
            "//div[@id='want_internet_id']/div/span").click()
        time.sleep(5)
        js = 'document.querySelectorAll("select")[0].style.display="block";'
        driver.execute_script(js)

        select = Select(driver.find_element_by_name('select_networktype'))
        select.select_by_value('Static')
        driver.find_element_by_id('staticIpaddr').send_keys(ip)
        driver.find_element_by_id('staticmask').send_keys(mask)
        driver.find_element_by_id("savebutton").click()
        try:
            element = driver.find_element_by_id('errorinfo_6')
        except NoSuchElementException as msg:
            L.info("没有找到元素:" + msg)
        else:
            self.assertEqual('请输入默认网关地址。', element.text)
        L.info("test_nogateway STOP")
Пример #17
0
 def test_wrongip(self):
     """输入错误格式的ip地址,检查提示语"""
     L.info("test_wrongip:输入错误格式的ip地址,检查提示语")
     driver = self.driver
     print("caseid:004")
     result = 0
     driver.get(self.baseurl)
     login(driver)
     driver.implicitly_wait(2)
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     driver.find_element_by_id("lang_dhcpsever").click()
     time.sleep(3)
     # 清除输入框中的内容
     driver.find_element_by_id("lanIP").clear()
     wrongip = ['192.168.www.4', '192.!23.tt.com', '192.168.%$.#', '1 92.168.  34', '192.168.344.2', '192.-168.3.2']
     for ip in wrongip:
         driver.find_element_by_id("lanIP").send_keys(ip)
         driver.find_element_by_id("savebutton5").click()
         try:
             driver.find_element_by_id("errorinfo_1")
         except e.NoSuchElementException:
             L.error(traceback.format_exc())
         else:
             if (driver.find_element_by_id("errorinfo_1").text == "IP地址含非法字符,请重新输入。")or\
                     (driver.find_element_by_id("errorinfo_1").text == "IP地址格式错误,请重新输入。"):
                 result += 1
                 driver.find_element_by_id("lanIP").clear()
                 time.sleep(2)
                 print("result:"+str(result))
     self.assertEqual(len(wrongip), result)
     L.info("test_wrongip STOP")
Пример #18
0
    def test_cancelreboot(self):
        """点击重启路由器后,点击取消"""
        L.info(" test_cancelreboot START:点击重启路由器后,点击取消,确认可以成功取消")
        driver = self.driver
        print("caseid:025")
        driver.get(self.baseurl)
        #登录系统
        login(driver)
        #进入无线名称页面将无线名称修改为frt_test
        time.sleep(2)
        try:
            driver.find_element_by_id("wirless").click()
            driver.find_element_by_id('wifiName_24').clear()
            driver.find_element_by_id('wifiName_24').send_keys("frt_test")
            time.sleep(5)
            driver.find_element_by_xpath("//input[@id='savebutton']").click()
        except e.InvalidElementStateException:
            L.error(traceback.format_exc())

        time.sleep(5)
        result = True
        try:
            driver.find_element_by_id("saveconfirm2_5G").click()
            WebDriverWait(driver, 20).until(
                EC.invisibility_of_element_located(
                    (By.ID, "CreatePopAlertMessage")))
            """js = "document.getElementById('wifiName_24').value;"
            t = driver.execute_script(js)

            if t!="frt_test":
                L.info("无线wifi名称未保存成功,测试终止")
                result=False
                self.assertTrue(True,result)

            else:"""
            driver.find_element_by_xpath(
                "//div[@id='want_more_id']/div").click()
            time.sleep(1)
            driver.find_element_by_id("ic_systemSetup").click()
            time.sleep(2)
            driver.find_element_by_id("lang_reboot").click()
            time.sleep(2)
            driver.find_element_by_id("btn_reboot_router").click()
            time.sleep(2)
            driver.find_element_by_id("btn_reboot_cancel").click()
        except e.ElementNotVisibleException:
            L.error(traceback.format_exc())
        L.info("test_cancelreboot STOP")
Пример #19
0
 def test_goto_login(self):
     """登录页跳转测试"""
     L.info("test_goto_login START:登录页面第一个测试用例,测试是否能成功跳转到登录页面")
     driver=self.driver
     print("caseid:011")
     driver.get(self.baseurl)
     L.info("URL 输入后的页面名称:%s" % driver.title)
     self.assertEqual(driver.title,"DIR-823Pro")
     L.info("test_goto_login STOP")
Пример #20
0
 def test_setpasswordright(self):
     """原密码错误时提示信息检查"""
     L.info("test_crrentpswderror START:原密码错误时的提示语检查")
     driver = self.driver
     print("caseid:021")
     currpassword = self.currpassword
     newpassword = self.newpassword
     driver.get(self.baseurl)
     login(driver)
     driver.implicitly_wait(30)
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     time.sleep(1)
     driver.find_element_by_id("ic_systemSetup").click()
     time.sleep(3)
     driver.find_element_by_xpath("//li[@id='liaccount']/a").click()
     driver.find_element_by_id("current_password").send_keys(currpassword)
     driver.find_element_by_id("new_password").send_keys(newpassword)
     driver.find_element_by_id("confirm_password").send_keys(newpassword)
     time.sleep(3)
     driver.find_element_by_id("savebutton5").click()
     time.sleep(20)
     driver.find_element_by_id("admin_Password1").send_keys(newpassword)
     driver.find_element_by_id("logIn_btn").click()
     time.sleep(5)
     self.assertEqual("http://192.168.0.1/Home.html", driver.current_url)
     #再次改回原密码:
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     time.sleep(1)
     driver.find_element_by_id("ic_systemSetup").click()
     time.sleep(3)
     driver.find_element_by_xpath("//li[@id='liaccount']/a").click()
     driver.find_element_by_id("current_password").send_keys(newpassword)
     driver.find_element_by_id("new_password").send_keys(currpassword)
     driver.find_element_by_id("confirm_password").send_keys(currpassword)
     time.sleep(3)
     driver.find_element_by_id("savebutton5").click()
     time.sleep(20)
Пример #21
0
 def test_lanipinrange(self):
     """用例失败的原因是因为元素能定位到,但是拿不到值"""
     L.info("test_lanipinrange START:ip地址填正确是否可以保存成功")
     driver = self.driver
     print("caseid:009")
     driver.get(self.baseurl)
     login(driver)
     time.sleep(2)
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     driver.find_element_by_id("lang_dhcpsever").click()
     time.sleep(3)
     driver.find_element_by_id("startLanIp").clear()
     driver.find_element_by_id("startLanIp").send_keys("100")
     driver.find_element_by_id("endLanIp").clear()
     driver.find_element_by_id("endLanIp").send_keys("150")
     driver.find_element_by_id("savebutton5").click()
     time.sleep(1)
     try:
         element = WebDriverWait(driver, 60).until(
             EC.invisibility_of_element_located((By.ID, "CreatePopAlertMessage"))
         )
     finally:
         self.assertEqual(100,driver.find_element_by_id("startLanIp").text)
         L.info("test_lanipinrange STOP")
Пример #22
0
    def test_wifinamehide(self):
        """隐藏wifi 名字不被发现"""
        L.info("test_wifinamehide START:隐藏wifi 名字不被发现后,查看电脑的无线wifi列表 是否还有,无线名字 ")
        driver = self.driver
        print("caseid:043")
        driver.get(self.baseurl)
        login(driver)
        time.sleep(2)
        driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
        time.sleep(1)
        driver.find_element_by_id("lang_wirelessSetUp").click()
        time.sleep(1)
        driver.find_element_by_id("lang_advwlanset").click()
        time.sleep(10)
        driver.find_element_by_id("wlan_status").click()
        driver.find_element_by_id("savebutton").click()
        WebDriverWait(driver, 20).until(
            EC.invisibility_of_element_located((By.ID, "CreatePopAlertMessage"))
        )
        result = True
        p = subprocess.Popen('netsh wlan show network', stdout=subprocess.PIPE)
        # print(p.stdout.readlines())
        for line in p.stdout.readlines():
            if not re.search('SSID\s+\d+\s+:\frt_test', str(line)):
                L.info("no found")
            else:
                result = False
                break
        self.assertTrue(result)
        #测试完成后恢复初始状态
        time.sleep(10)
        driver.find_element_by_id("wlan_status").click()
        time.sleep(2)
        try:

            WebDriverWait(driver, 20).until(
                EC.invisibility_of_element_located((By.ID, "CreatePopAlertMessage"))
            )
        except NoSuchElementException:
            L.info(traceback.format_exc())
        driver.find_element_by_id("savebutton").click()

        L.info("test_wifinamehide STOP")
Пример #23
0
 def test_login_nopasswordenter(self):
     """不输入密码时的提示信息检查"""
     L.info("test_login_nopasswordenter START:不输入密码时的提示信息检查")
     driver = self.driver
     print("caseid:013")
     driver.get(self.baseurl)
     driver.find_element_by_id("logIn_btn").click()
     error1=driver.find_element_by_id("errorinfo_1")
     time.sleep(1)
     result=True
     try:
         if error1.is_displayed():
             L.info(error1.text)
             self. assertEqual(error1.text,"请输入登录密码。")
         else :
             result=False
     except e.NoSuchElementException:
         L.error(traceback.format_exc())
     self.assertTrue(result)
     L.info("test_login_nopasswordenter STOP")
Пример #24
0
    def test_defaultcheck(self):
        """默认项检查"""

        L.info("test_defaultcheck START:局域网页面默认项检查")
        driver = self.driver
        print("caseid:002")
        driver.get(self.baseurl)
        login(driver)
        time.sleep(3)
        driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
        time.sleep(2)
        driver.find_element_by_id("lang_dhcpsever").click()
        #t=driver.find_element_by_id("lanIP").get_attribute('name')
        js = "document.getElementById('lanIP').value;"
        #js="eval(document.getElementById('lanIP')).value;"
        #js=eval(document.getElementById('lanIP').value)

        t=driver.execute_script(js)
        L.info('###############')
        L.info(t)
        L.info("test_defaultcheck STOP")
Пример #25
0
    def test_wifinameright(self):
        """各种组合下的无线名称是否支持"""
        L.info("test_wifinameright START:各种组合下的无线名称是否支持")
        driver = self.driver
        print("caseid:037")
        driver.get(self.baseurl)
        driver.implicitly_wait(5)
        result=0
        login(driver)
        time.sleep(2)
        driver.find_element_by_id("wirless").click()
        time.sleep(1)
        wifiname=['wer','#¥@','@!$as','@#¥12','1','22222222________!!!!!!!!aaaaaaaa','测试','hello world',"frt_test"]
        #wifiname = ['wer']
        for i in wifiname:
            time.sleep(3)
            driver.find_element_by_id('wifiName_24').clear()
            driver.find_element_by_id('wifiName_24').send_keys(i)
            time.sleep(5)
            driver.find_element_by_xpath("//input[@id='savebutton']").click()
            #driver.find_element_by_id('savebutton').click()
            time.sleep(2)
            try:
                driver.find_element_by_id("saveconfirm2_5G").click()
                WebDriverWait(driver, 20).until(
                    EC.invisibility_of_element_located((By.ID, "CreatePopAlertMessage"))
                )
                js = "document.getElementById('wifiName_24').value;"
                t = driver.execute_script(js)
                if i == t:
                    result += 1
                else:
                    L.info("未保存成功")
            except NoSuchElementException :
                 L.info(traceback.format_exc())

        self.assertEqual(len(wifiname), result, "目前失败的原因是input 元素取不到值")
        L.info("test_wifinameright STOP")
Пример #26
0
    def test_login_wrongpassword(self):
        """输入错误密码"""
        L.info("test_login_wrongpassword START:密码错误时的提示语检查")
        driver=self.driver
        print("caseid:014")
        wrongpassword=self.wrongpassword
        driver.get(self.baseurl)
        driver.find_element_by_id("admin_Password1").send_keys("123")
        driver.find_element_by_id("logIn_btn").click()
        time.sleep(1)
        error2 = driver.find_element_by_id("errorinfo_1")
        result=True
        try:

            if error2.is_displayed():
                L.info(error2.text)
                self.assertEqual(error2.text,"密码错误,请重新输入。")
            else:
                result=False
        except e.NoSuchElementException:
            L.error(traceback.format_exc())
        self.assertTrue(result, True)
        L.info("test_login_wrongpassword STOP")
Пример #27
0
 def test_gotolan(self):
     """测试是否能成功跳转到局域网页面"""
     L.info("test_gotolan START:测试是否能成功跳转到局域网页面")
     driver = self.driver
     print("caseid:001")
     driver.get(self.baseurl)
     #调用登录模块登录
     login(driver)
     driver.implicitly_wait(30)
     driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
     time.sleep(2)
     driver.find_element_by_id("lang_dhcpsever").click()
     currenturl=driver.current_url
     L.info("到达局域网页面后的URL:%s" % currenturl)
     self.assertEqual("http://192.168.0.1/DhcpServer.html",currenturl)
     L.info("test_gotolan STOP")
Пример #28
0
 def test_nopassword(self):
     """不填写密码时的功能检查"""
     L.info("test_nopassword START:不填写密码时的功能检查")
     driver = self.driver
     print("caseid:039")
     driver.get(self.baseurl)
     login(driver)
     time.sleep(2)
     driver.find_element_by_id("wirless").click()
     time.sleep(3)
     driver.find_element_by_id("password1_24").clear()
     driver.find_element_by_xpath("//input[@id='savebutton']").click()
     try:
         driver.find_element_by_id("saveconfirm2_5G").click()
         WebDriverWait(driver, 20).until(
             EC.invisibility_of_element_located((By.ID, "CreatePopAlertMessage"))
         )
         js = "document.getElementById('password1_24').value;"
         t = driver.execute_script(js)
         L.info(t)
         self.assertEqual(t,None)
     except NoSuchElementException:
         L.info(traceback.format_exc())
     L.info("test_nopassword STOP")
Пример #29
0
 def test_logout(self):
     """退出功能测试"""
     L.info(" test_logout START:测试退出功能")
     loginurl = self.baseurl
     driver = self.driver
     print("caseid:026")
     driver.get(self.baseurl)
     # 登录系统
     login(driver)
     try:
         time.sleep(2)
         driver.find_element_by_id("logoutword").click()
         time.sleep(2)
     except e.ElementNotVisibleException:
         L.error(traceback.format_exc())
     current_url = driver.current_url
     self.assertEqual(current_url, loginurl + "/Login.html")
     L.info("test_logout STOP")
Пример #30
0
    def test_nopassword(self):
        """不输入原密码时,直接点击保存,提示信息检查"""
        L.info("test_nopassword START:不输入原来的登录密码时,提示语检查")
        driver = self.driver
        print("caseid:015")
        driver.get(self.baseurl)
        login(driver)
        driver.implicitly_wait(30)
        driver.find_element_by_xpath("//div[@id='want_more_id']/div").click()
        time.sleep(1)

        driver.find_element_by_id("ic_systemSetup").click()
        time.sleep(3)
        driver.find_element_by_xpath("//li[@id='liaccount']/a").click()
        driver.find_element_by_id("savebutton5").click()
        try:
            if (driver.find_element_by_id("errorinfo_1").is_displayed()):
                errorinfo = driver.find_element_by_id("errorinfo_1").text
                self.assertEqual(errorinfo, "原登录密码不能为空,请重新输入。")
        except e.NoSuchElementException:
            L.error(traceback.format_exc())
        L.info("test_nopassword STOP")