本文整理汇总了Python中common_suite_file.CommonSuiteData.switch_to_moudle方法的典型用法代码示例。如果您正苦于以下问题:Python CommonSuiteData.switch_to_moudle方法的具体用法?Python CommonSuiteData.switch_to_moudle怎么用?Python CommonSuiteData.switch_to_moudle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_suite_file.CommonSuiteData
的用法示例。
在下文中一共展示了CommonSuiteData.switch_to_moudle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testAdEx
# 需要导入模块: from common_suite_file import CommonSuiteData [as 别名]
# 或者: from common_suite_file.CommonSuiteData import switch_to_moudle [as 别名]
class testAdEx():
def __init__(self,driver):
self.driver = driver
self.log = log()
self.cmf = commonFun(driver)
self.getElem = getElement(driver)
self.cnEnde = cnEncode()
self.adExElem = AdExtractPage(self.driver)
self.tableElem = tableElement(self.driver)
self.selectElem = selectElement(driver)
self.dataFile = dataFileName()
self.frameElem = frameElement(self.driver)
self.loginFun = loginPage(self.driver)
self.commonSuite = CommonSuiteData(self.driver)
u'''提示内容框元素路径'''
def login_msg(self):
login_msg = "html/body/div[1]/div/table/tbody/tr[2]/td[2]/div/table/ \
tbody/tr[2]/td[2]/div"
return login_msg
u'''修改密码弹出框'''
def modey_pwd_msg(self):
self.frameElem.switch_to_content()
modey_msg = "html/body/div[1]/div/table/tbody/tr[2]/td[2]/div/table/ \
tbody/tr[1]/td/div/div"
return modey_msg
u'''关闭修改密码弹出框'''
def close_aui(self):
self.frameElem.switch_to_content()
close_aui = "html/body/div[1]/div/table/tbody/tr[2]/td[2]/div/table/ \
tbody/tr[1]/td/div/a"
return close_aui
def test_win_check_point(self,value,data):
elemText = self.getElem.find_element_wait_and_compare_text("xpath",value,data)
if elemText:
# 页面的内容与检查点内容一致,测试点通过
self.log.log_detail(data[0], True)
else:
#页面抓取到的内容与检查点不一致,测试点不通过
self.log.log_detail(data[0],False)
u'''获取测试数据
Parameters:
- sheetname:sheet名称
return:表格数据
'''
def get_table_data(self,sheetname):
dataFile = dataFileName()
filePath = dataFile.get_ad_extract_test_url()
adFileData = dataFile.get_data(filePath,sheetname)
return adFileData
u'''没有弹出框的校验'''
def check_without_pop_up(self,type,data):
retype = self.cnEnde.is_float(type)
num = self.adExElem.get_account_count(retype)
recount = int(self.cnEnde.is_float(data[5]))
#判断测试项是否通过
if self.adExElem.get_account_count(retype) == recount:
self.log.log_detail(data[0], True)
else:
self.log.log_detail(data[0], False)
def base_on_dataRow(self,dataRow,data,flag):
#AD发现账号列表移动到已选账号列表
if dataRow == 1 or dataRow == 2:
if dataRow == 1:
self.frameElem.from_frame_to_otherFrame("mainFrame")
self.adExElem.set_new_account(data[3])
self.adExElem.click_new_query_button()
self.adExElem.click_new_reset_button()
self.adExElem.click_new_query_button()
self.adExElem.select_type(data[2],data[3])
self.adExElem.new_to_selected()
self.adExElem.set_pwd(data[6])
self.cmf.click_login_msg_button()
#从已选账号列表移动到AD发现账号列表
if dataRow == 2:
self.commonSuite.login_and_switch_to_sys()
self.commonSuite.switch_to_moudle(u"系统配置", u"AD定时抽取")
self.adExElem.discover_tab()
self.adExElem.set_selected_account(data[3])
self.adExElem.click_selected_button()
self.adExElem.click_selected_reset_button()
self.adExElem.select_type(data[2],data[3])
self.adExElem.select_to_new()
self.loginFun.quit()
self.frameElem.switch_to_content()
self.loginFun.set_login_username(data[3])
self.loginFun.set_login_pwd(data[6])
self.loginFun.click_login_button()
if dataRow ==1:
self.test_win_check_point(self.modey_pwd_msg(),data)
self.getElem.find_element_with_wait_clickable_and_click("xpath",self.close_aui())
if dataRow ==2:
#.........这里部分代码省略.........
示例2: testTime
# 需要导入模块: from common_suite_file import CommonSuiteData [as 别名]
# 或者: from common_suite_file.CommonSuiteData import switch_to_moudle [as 别名]
class testTime(object):
def __init__(self,driver):
self.driver = driver
self.log = log()
self.cmf = commonFun(driver)
self.frameElem = frameElement(driver)
self.testrole = testRole(driver)
self.command = CommandRule(driver)
self.comsuit = CommonSuiteData(driver)
self.timerule = TimeRule(driver)
self.getElem = getElement(driver)
self.loginElem = loginPage(self.driver)
u'''获取测试数据
Parameters:
- sheetname:sheet名称
return:表格数据
'''
def get_table_data(self, sheetname):
dataFile = dataFileName()
timerulPath = dataFile.get_timerule_test_data_url()
timerulData = dataFile.get_data(timerulPath, sheetname)
return timerulData
u'''添加时间规则'''
def add_time_rule_001(self):
#日志开始记录
self.log.log_start("add_time_rule")
#获取添加时间规则测试数据
timerulData = self.get_table_data("add_time_rule")
#保存成功的弹出框
comrulMsg = self.testrole.popup()
#无检查点的测试项标识,如果为True说明通过
flag = False
for dataRow in range(len(timerulData)):
data = timerulData[dataRow]
try:
#如果不是第一行标题,则读取数据
if dataRow != 0:
self.command.click_add_button()
self.timerule.set_rulename((data[2]))
self.timerule.select_depart(data[3])
self.timerule.start_date(data[4])
self.timerule.date_of_termination(data[6], data[7])
self.timerule.set_status_type(data[8])
self.timerule.set_time(data[9], data[10], data[11])
self.timerule.set_descrip(data[12])
self.timerule.click_save_time()
self.frameElem.switch_to_content()
self.cmf.test_win_check_point("xpath", comrulMsg, data, flag)
self.command.click_back_command()
self.comsuit.switch_to_moudle(u'运维管理', u'用户')
self.timerule.edit_user_time_rule(data[13], data[14])
if dataRow != 5:
self.comsuit.switch_to_moudle(u'运维管理', u'规则定义')
self.command.click_left_rule(1)
except Exception as e:
print ("add_time_rule fail:" + str(e))
self.comsuit.user_quit()
self.log.log_end("add_time_rule")
u'''添加时间规则结果'''
def add_time_rule_result_002(self):
#日志开始记录
self.log.log_start("add_time_rule_result")
#获取添加时间规则测试数据
timerulData = self.get_table_data("add_time_rule")
#保存成功的弹出框
comrulMsg = self.testrole.popup()
#无检查点的测试项标识,如果为True说明通过
flag = False
for dataRow in range(len(timerulData)):
data = timerulData[dataRow]
try:
#如果不是第一行标题,则读取数据
if dataRow != 0:
list = [data[15], data[16], data[17], data[18], data[19]]
self.loginElem.login(list)
self.frameElem.from_frame_to_otherFrame("topFrame")
if self.getElem.is_element_exsit('id', "logout"):
self.comsuit.user_quit()
else:
self.cmf.click_login_msg_button()
flag = True
self.cmf.test_win_check_point("xpath", comrulMsg, list, flag)
except Exception as e:
print ("add_time_rule_result fail:" + str(e))
self.comsuit.login_and_switch_to_dep()
self.comsuit.switch_to_moudle(u'运维管理', u'规则定义')
self.command.click_left_rule(1)
self.log.log_end("add_time_rule_result")
u'''编辑时间规则'''
def mod_time_rule_003(self):
#日志开始记录
#.........这里部分代码省略.........
示例3: print
# 需要导入模块: from common_suite_file import CommonSuiteData [as 别名]
# 或者: from common_suite_file.CommonSuiteData import switch_to_moudle [as 别名]
try:
#如果不是第一行标题,则读取数据
if dataRow != 0 :
self.frameElem.from_frame_to_otherFrame("rigthFrame")
#self.appElem.operate_account_manage(data[2])
self.appElem.operate_account_del(data[3])
self.cmf.click_login_msg_button()
#判断测试项是否通过
self.check_with_pop_up(data,flag)
#清空标识状态
flag = False
except Exception as e:
print ("Del account fail: ") + str(e)
self.log.log_end("Delaccount")
if __name__ == "__main__":
browser = setDriver().set_local_driver()
commonSuite = CommonSuiteData(browser)
appTest = testApp(browser)
commonSuite.login_and_switch_to_sys()
commonSuite.switch_to_moudle(u"系统配置", u"关联服务")
# appTest.add_app_001()
# appTest.edit_app_002()
# appTest.check_app_003()
# appTest.query_app_004()
# appTest.add_account_006()
# appTest.edit_account_007()
# appTest.del_account_008()
# appTest.del_app_005()
示例4: Backuprestore
# 需要导入模块: from common_suite_file import CommonSuiteData [as 别名]
# 或者: from common_suite_file.CommonSuiteData import switch_to_moudle [as 别名]
#.........这里部分代码省略.........
- port:syslog端口
'''
def set_port(self, port):
sysport = self.cnEn.is_float(port)
self.frameElem.from_frame_to_otherFrame("rigthFrame")
self.getElem.find_element_wait_and_clear_EC("id", "port")
self.getElem.find_element_wait_and_sendkeys("id", "port", sysport)
u'''点击syslog保存'''
def click_syslog_save(self):
self.frameElem.from_frame_to_otherFrame("rigthFrame")
self.getElem.find_element_wait_and_click_EC("id", "save_syslog")
u'''获取syslogip值'''
def get_syslog_port(self):
self.frameElem.from_frame_to_otherFrame("rigthFrame")
selem = self.getElem.find_element_with_wait_EC("id", "port")
value = selem.get_attribute("value")
return value
u'''获取文件名称'''
def get_file_name(self):
self.frameElem.from_frame_to_otherFrame("rigthFrame")
selem = self.getElem.find_element_with_wait_EC("xpath", ".//*[@id='content_rt02']/div/table/tbody/tr[2]")
value = selem.get_attribute('id')
return value
u'''编辑syslog
parameter:
- ip:syslogip
- port:端口
'''
def set_syslog(self, port, ip='no'):
self.comsuit.switch_to_moudle(u'系统配置', u'关联服务')
self.command.click_left_rule(1)
if ip != 'no':
self.set_syslogip(ip)
self.set_port(port)
self.click_syslog_save()
self.frameElem.switch_to_content()
self.cmf.click_msg_button(1)
u'''检验syslog端口是否为备份之前信息
parameter:
- port:端口
- checklog:检验信息
'''
def check_syslog_content(self, port, checklog):
self.comsuit.switch_to_moudle(u'系统配置', u'关联服务')
self.command.click_left_rule(1)
elemText = self.get_syslog_port()
strdata3 = self.cnEn.is_float(port)
if elemText == strdata3:
self.log.log_detail(checklog, True)
else:
self.log.log_detail(checklog, False)
u'''校验用户或者角色信息
Parameters:
- namevalue:传入的要被查询名称
- name:表格列的name属性
- checklog:日志信息
return:定位该名称位于第几行
'''
def check_content(self,namevalue, name, checklog):
row = self.cmf.find_row_by_name(namevalue, name)