def _excel_Data(title_name): """ yaml读取用例位置 :return: """ # 读取excel配置文件中存储的用例所在地 conf = readModel.establish_con(model="excelmodel") # 读取配置文件中设置用例关键字的信息 argument = get_argument_data() argument_menu = conf.get("admin_excel", argument['module']) argument_module = conf.get("admin_excel", argument[INVENTORY['module']]['module']) module_excle_path = os.path.join(argument_menu, argument_module) # 读取相应路径中的数据 read = OpenExcelPandas( name=r'' + module_excle_path, sheet=argument[INVENTORY['module']][INVENTORY['sheet']]) ex_data = read.internal_read_excel(title_name) df_index = ex_data.index ex_data = [ex_data.loc[df_i] for df_i in df_index] del argument return ex_data
def warehousing_login(self, user_pass): """ 登录操作 :param user_pass: 区分登录者类型 :return: """ conf = readModel.establish_con(model="model") # 获取账号密码 if user_pass: account = conf.get("username", "admin_dispatch_account") password = conf.get("username", "admin_dispatch_password") else: account = conf.get("username", "level_dispatch_account") password = conf.get("username", "level_dispatch_password") # 账号 self.op_br.is_visible_inputs(locator='phone', way='id', parameter=account) # 密码 self.op_br.is_visible_inputs(locator='password', way='id', parameter=password) # 点击登录 self.op_br.is_visible_clicks(locator='loginBtn', way='id') del conf sleep(1) pass
def open_browser(self, option, liulanqi='chrome', options=None): # 打开浏览器 bc = browser_confirm.__new__(browser_confirm) conf = readModel.establish_con(model="model") url = conf.get("wap", option) self.driver = bc.url_opens(url, liulanqi, options) self.drop.drivers = self.driver pass
def sigin_user_login(self, account, password): # 找到账号密码 conf = readModel.establish_con(model="model") account = conf.get("username", account) password = conf.get("username", password) # 输入账号密码点击登录 self.a_input.name_input(self.driver, 'username', account) self.a_input.name_input(self.driver, 'password', password) self.a_click.id_confirm_prompt(self.driver, "loginBtn") pass
def _browser(self, option): # 1.创建浏览器所在函数的对象 bc = browser_confirm.__new__(browser_confirm) conf = readModel.establish_con(model="model") url = conf.get("wap", option) # 2.调用已经规划好的浏览器函数 self.driver = bc.url_opens(url) return self.driver
def open_driver(self, user_url): self.driver = webdriver.Chrome(executable_path=os.path.join( r'E:\drivers\Drivers', 'chromedriver700353867.exe')) self.driver.maximize_window() # 输入网址 # 等待网页加载,加载时间为10s,加载完就跳过 # 隐形等待时间和显性等待时间不同时,默认使用两者之间最大的那个 self.driver.implicitly_wait(5) url = readModel.establish_con(model="model").get("wap", user_url) self.driver.get(url) pass
def administrator_login(self, *user_ward): """ 登录操作 :param user_name: :param pass_ward: :return: """ conf = readModel.establish_con(model="model") # 获取账号密码 account = conf.get("username", "atorage_account") password = conf.get("username", "atorage_password") # 账号 self.is_input_execute(locator='phone', way_type='js', way='id', parameter=account) # 密码 self.is_input_execute(locator='password', way_type='js', way='id', parameter=password) # 点击登录 self.is_click_execute(locator='loginBtn', way_type='js', way='id') sleep(1) pass
def _excel_Data(self, model_key, filename, SHEETNAME): """ 读取配置文件Ini所在地的内容 :param model_key: :param filename: :param SHEETNAME: :return: """ # 获取excel路径 conmodel = readModel.establish_con(model="excelmodel") consyst = conmodel.get("admin_excel", model_key) excelname = conmodel.get("admin_excel", filename) file_path = os.path.join(consyst, excelname) # 读取相应路径中的数据 read = OpenExcelPandas(file_path, sheet=SHEETNAME) excelData = read.internal_read_excel() return excelData
def warehousing_login(self): """ 登录操作 :param user_name: :param pass_ward: :return: """ conf = readModel.establish_con(model="model") # 获取账号密码 account = conf.get("username", "seller_account") password = conf.get("username", "seller_password") # 账号 self.op_br.is_visible_inputs(locator='phone', way='id', parameter=account) # 密码 self.op_br.is_visible_inputs(locator='password', way='id', parameter=password) # 点击登录 self.op_br.is_visible_clicks(locator='loginBtn', way='id') del conf sleep(1) pass
def get_account_account_password(self): conf = readModel.establish_con(model="model") # 获取账号密码 account = conf.get("username", "admin_account") password = conf.get("username", "admin_password") return account, password