def __init__(self): real_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) data_path = os.path.join(os.path.join(real_path,"data"),"czx_user.xls") #获取数据文件路径 self.url = Common_Read().get_config_data('czx_url') #由配置文件读取测试地址 self.data_value = Common_Read(data_path, 'user2').dict_data() #由数据文件读取用户信息并转换为字典数据 Common_Read().add_waittime_excel()
def __init__(self): real_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) data_path = os.path.join(os.path.join(real_path,"data"),"cze_data.xls") #获取数据文件路径 self.url = Common_Read().get_config_data("cze_url") #由配置文件读取测试地址 self.data_value = Common_Read(data_path, 'user_elective').dict_data() #由数据文件读取用户信息并转换为字典数据 Common_Read().add_waittime_excel() Common_Read().clear_screenshot(r"C:\Users\safecode\Desktop\cze_elective_open_vm") Common_Read().clear_screenshot(r"C:\Users\safecode\Desktop\elective_open") time_value = int(time.time()) self.path = os.path.join(os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))),"test_report"),"课程性能测试报告%d.docx" %time_value) print(self.path) self.doc = Document() self.doc.add_heading('性能测试开机结果',0) self.doc.save(self.path)
def __init__(self,driver): #获取浏览器句柄 self.driver = driver #将被操作的excel文件路径,及具体工作薄 real_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) data_path = os.path.join(os.path.join(real_path,"data"),"czx_data.xls") sheetName = "czx_login" #工作薄内容为登录的操作步骤数据 #读取excel文件,并实例化 data = Common_Read(data_path, sheetName) #转化excel文件数据为可操作字典数据 self.data_value = data.dict_data() #实例化浏览器基本操作类 self.b = Base(self.driver)
def __init__(self, driver, execl_name, sheet_name, data_Catalog="data", copy_execl_name="wait_time.xls"): #获取浏览器操作句柄 self.driver = driver #获取数据excel表文件位置,及从具体工作薄获取浏览器操作步骤数据 config_path = os.path.dirname( os.path.dirname(os.path.realpath(__file__))) filepath = os.path.join(os.path.join(config_path, data_Catalog), execl_name) filepath2 = os.path.join(os.path.join(config_path, data_Catalog), copy_execl_name) #读取excel文件,并实例化 data = Common_Read(filepath, sheetName=sheet_name) #cze_Learn_course为工作溥名称 data2 = Common_Read(filepath2, 'wait_time') #转化excel文件数据为可操作字典数据 self.data_value = data.dict_data() self.time_data = data2.dict_data()
def __init__(self): real_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) data_path = os.path.join(os.path.join(real_path, "data"), "czx_data.xls") #获取数据文件路径 self.url = Common_Read().get_config_data("czx_url") #由配置文件读取测试地址 self.data_value = Common_Read(data_path, 'user').dict_data() #由数据文件读取用户信息并转换为字典数据 Common_Read().add_waittime_excel() time_value = int(time.time()) kc_path = r"C:\Users\safecode\Desktop\jietu\kecheng" self.kc_jt_path = os.path.join(kc_path, "kecheng%d\\" % time_value) if not os.path.exists(self.kc_jt_path): os.mkdir(self.kc_jt_path) self.path = os.path.join( os.path.join( os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "test_report"), "性能测试报告%d.docx" % time_value) print(self.path) self.doc = Document() self.doc.add_heading('性能测试结果', 0) self.doc.save(self.path)
from common.base import Base import time,datetime from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys import os,traceback from common.logger import Log from selenium import webdriver import pyautogui as pag from common.common_rwcd import Common_Read from docx import Document from docx.shared import Inches start_value = Common_Read().get_config_data("value") x = False find_result = True vm_name = {} start_time = "" over_time = "" open_vm_time_all = {} open_vm_start_time = {} open_vm_end_time = {} class Script_value(Base): '''使用selenium界面操作封装方法''' def __init__(self,driver,time_data="",path="",screenshot_path=""): self.driver = driver global start_time global over_time