win32api.PostMessage(openBt, win32con.WM_LBUTTONUP, 0, 0) def gettime(self): self.now = time.strftime("%Y-%m-%d %H-%M-%S") return self.now def getScreenShot(self, module): time = self.gettime() # image_file = E:/python_project/daiwei image_file = os.path.dirname(os.path.dirname( __file__)) + '/warehouse/screenshots/%s_%s.png' % (module, time) logging.info('get %s screenshot' % module) self.driver.get_screenshot_as_file(image_file) def get_csv_data(self, csv_file, line): ''' 获取csv文件制定行的数据 param csv_file:csv文件路径 param line:数据行数 return: ''' with open(csv_file, 'r', encoding='utf-8-sig') as file: reader = csv.reader(file) for index, row in enumerate(reader, 1): if index == line: return row if __name__ == '__main__': driver = launch_browser()
def setUp(self): logging.info('======setUp=========') self.driver = launch_browser() self.verificationErrors = [] self.accept_next_alert = True