當前位置: 首頁>>代碼示例>>Python>>正文


Python CommonSuiteData.switch_to_moudle方法代碼示例

本文整理匯總了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:
#.........這裏部分代碼省略.........
開發者ID:isomper,項目名稱:testIsomp,代碼行數:103,代碼來源:test_ad_extracte.py

示例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):
		#日誌開始記錄
#.........這裏部分代碼省略.........
開發者ID:isomper,項目名稱:testIsomp,代碼行數:103,代碼來源:test_time_rule.py

示例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()
開發者ID:isomper,項目名稱:testIsomp,代碼行數:33,代碼來源:test_app_conf.py

示例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)
開發者ID:isomper,項目名稱:testIsomp,代碼行數:70,代碼來源:test_backup_restore_ment.py


注:本文中的common_suite_file.CommonSuiteData.switch_to_moudle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。