def check_login_defualt_language(self): tmp = NavbarControl(self.driver) #点击页面上的退出按钮 tmp.logout() tmp1 = LoginBusiness(self.driver) #获取所选择的语言 result = tmp1.login_get_language() return result
def check_search(self): #检查页面中是否有搜索按钮 result1 = NavbarControl.check_search_buttton(self) #点击页面上的放大镜打开搜索框 NavbarControl.search_menu(self) #检查页面中是否有搜索框 result2 = NavbarControl.check_search_input(self) print result1, result2 return result1, result2
def check_mouse(self): tmp = NavbarControl(self.driver) #点击页面上的放大镜打开搜索框 tmp.search_menu() #点击概览菜单 tmp1 = OVBusiness(self.driver) tmp1.OV_menu() #检查页面中是否有搜索框 result = tmp.check_search_input() return result
def check_login_change_language(self, lang): tmp = NavbarControl(self.driver) #点击页面上的退出按钮 tmp.logout() tmp1 = LoginBusiness(self.driver) #点击页面上的语言按钮 tmp1.login_language_menu() tmp1.login_language_choose(lang) #获取所选择的语言 result = tmp1.login_get_language() return result
def check_blankvalue_search(self): tmp = NavbarControl(self.driver) #点击页面上的放大镜打开搜索框 tmp.search_menu() #在弹出的搜索框中输入空值,并在键盘中按enter tmp.set_search("") result = tmp.check_search_result() return result
def search_result(self, text): tmp = NavbarControl(self.driver) #点击页面上的放大镜打开搜索框 tmp.search_menu() #在弹出的搜索框中输入信息,并在键盘中按enter tmp.set_search(text) #获取搜索的结果 return tmp.get_search_result()
def click_result(self, text, id_element): try: tmp = NavbarControl(self.driver) #点击页面上的放大镜打开搜索框 tmp.search_menu() #在弹出的搜索框中输入信息,并在键盘中按enter tmp.set_search(text) #点击搜索结果 tmp.click_search_result(text) self.driver.find_element_by_id(id_element) return True except: return False
def check_15s_validity(self): #点击接入点菜单 tmp1 = APSBusiness(self.driver) tmp1.APS_menu() #选择页面上的刷新时间间隔 tmp = NavbarControl(self.driver) tmp.refresh_menu() tmp.refresh_choose("15s") #获取主界面的运行时间 result1 = tmp1.get_uptime1() m = result1.split("m") a = int(m[-1].strip("s")) #如果现在运行时间大于45秒,则多等待15秒后再进行测试 if a >= 45: time.sleep(15) #获取主界面的运行时间 result1_2 = tmp1.get_uptime1() #等待设定的时间后 time.sleep(15) result2 = tmp1.get_uptime1() x = result1_2.split("m") c = int(x[-1].strip("s")) n = result2.split("m") b = int(n[-1].strip("s")) result = b - c print c, b, result return result #等待设定的时间后 time.sleep(15) result2 = tmp1.get_uptime1() n = result2.split("m") b = int(n[-1].strip("s")) result = b - a print a, b, result return result
def check_language_search(self, lang, text): tmp = NavbarControl(self.driver) #点击页面上的语言按钮 tmp.language_menu() #选择页面上的语言 tmp.language_choose(lang) #输入信息,获取搜索结果 result = NavbarBusiness.search_result(self, text) return result
def check_language_validity(self, lang): tmp = NavbarControl(self.driver) #点击页面上的语言按钮 tmp.language_menu() #选择页面上的语言 tmp.language_choose(lang) #找到导航栏固件的元素定位 result = self.driver.find_element_by_id("versioninfo").text print result return result
def check_many_change_refresh_time(self): result = [] for i in range(5): for T in ["15s", "1min", "2min", "5min", u"永不"]: #选择页面上的刷新时间间隔 tmp = NavbarControl(self.driver) tmp.refresh_menu() tmp.refresh_choose(T) #获取刷新时间 result1 = tmp.get_refresh_time() if result1 == T: result.append(True) else: result.append(False) print result return result
def check_never_validity(self): #点击接入点菜单 tmp1 = APSBusiness(self.driver) tmp1.APS_menu() #选择页面上的刷新时间间隔 tmp = NavbarControl(self.driver) tmp.refresh_menu() tmp.refresh_choose(u"永不") #获取主界面的运行时间 result1 = tmp1.get_uptime1() #等待2分钟 time.sleep(120) result2 = tmp1.get_uptime1() return result1, result2
def check_language_refresh(self, lang, Refresh_interval): tmp = NavbarControl(self.driver) #点击页面上的语言按钮 tmp.language_menu() #选择页面上的语言 tmp.language_choose(lang) #点击刷新时间按钮 self.driver.find_element_by_xpath(".//*[@title='%s']/div/div" % Refresh_interval).click() #获取刷新时间的语言 result = self.driver.find_element_by_xpath( ".//*[@title='%s']/ul/li[5]/a" % Refresh_interval).text print result return result
def check_reboot_refresh_time(self, web, username, pwd): #选择页面上的刷新时间间隔为5min tmp = NavbarControl(self.driver) tmp.refresh_menu() tmp.refresh_choose("5min") #重启路由 tmp1 = UpgradeBusiness(self.driver) tmp1.web_reboot(data_basic['DUT_ip']) #重新登录ap,获取刷新时间 self.driver.get(web) self.driver.implicitly_wait(10) #逻辑类对象,建一个实例 Lg = LoginBusiness(self.driver) Lg.login(username, pwd) #获取刷新时间 result = tmp.get_refresh_time() if result == "5min": return True else: return False
def check_min_validity(self, T): #点击接入点菜单 tmp1 = APSBusiness(self.driver) tmp1.APS_menu() #选择页面上的刷新时间间隔 tmp = NavbarControl(self.driver) tmp.refresh_menu() tmp.refresh_choose(T) #获取主界面的运行时间 result1 = tmp1.get_uptime1() n = result1.split("m") m = n[0].split("h") a = int(m[-1]) #如果现在运行时间大于55分钟,则多等待5分钟后再进行测试 if a >= 55: time.sleep(300) #获取主界面的运行时间 result1_2 = tmp1.get_uptime1() #等待设定的时间后 t = int(T.strip("min")) * 60 time.sleep(t) result2 = tmp1.get_uptime1() c = result1_2.split("m") d = c[0].split("h") e = int(d[-1]) f = result2.split("m") g = f[0].split("h") h = int(g[-1]) result = h - e print e, h, result return result #等待设定的时间后 t = int(T.strip("min")) * 60 time.sleep(t) result2 = tmp1.get_uptime1() x = result2.split("m") y = x[0].split("h") b = int(y[-1]) result = b - a print a, b, result return result
def check_change_refresh_time(self, time, username, pwd): tmp = NavbarControl(self.driver) #点击页面上的刷新时间间隔 tmp.refresh_menu() #选择页面上的刷新时间间隔 tmp.refresh_choose(time) #获取刷新时间 result1 = tmp.get_refresh_time() #点击接入点菜单 tmp1 = APSBusiness(self.driver) tmp1.APS_menu() #获取刷新时间 result2 = tmp.get_refresh_time() #点击页面上的退出按钮 tmp.logout() tmp2 = LoginBusiness(self.driver) #登录GWN7610的web界面 tmp2.login(username, pwd) #获取刷新时间 result3 = tmp.get_refresh_time() if (time in result1) and (time in result2) and (time in result3): return True else: return False
def __init__(self, driver): #继承SWControl类的属性和方法 NavbarControl.__init__(self, driver)