@author: Four Project: 选择菜单 """ import sys import time from Utils.log import Logger from Utils.DriverWait import Wait_Find from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.action_chains import ActionChains as AC send_time = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time())) # 获取当前时间 logger_message = Logger() def Selection_Menu(self, Menu_path): u"""选择菜单""" try: Wait_Find(self.browser, (By.XPATH, Menu_path)) self.browser.find_element_by_xpath(Menu_path).click() time.sleep(0.5) except Exception as Error: logger_message.logwarning( u"%s\t方法名:%s\t菜单异常%s" % (send_time, sys._getframe().f_code.co_name, Error)) raise
# -*- coding: utf-8 -*- """ Created: on 2018-04-11 @author: Four Project: common\Request_Package.py Request重新封装 """ import json import time from Utils.log import Logger Logger_Message = Logger() send_time = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time())) #获取当前时间 def send_requests(s, testdata, cookie=None): '''封装requests请求''' method = testdata["method"] description = testdata["description"] url = testdata["url"] # url后面的params参数 try: params = eval(testdata["params"]) except: params = None # 请求头部headers try: headers = eval(testdata["headers"]) except: