def get_window_img(self):
now = time.strftime("%Y-%m-%d_%H_%M_%S")
scrpath = r"D:\python\SDC_web\screenshots"
capturename = r'\\' + 'SDC_Interface_operation_024' + now + '.png'
wholepath = scrpath + capturename
try:
self.driver.save_screenshot(wholepath)
print("11111")
logger.info("屏幕截取成功,截图存放路径:%s" % wholepath)
logger.info("4445454566456")
except NameError as e:
logger.error("屏幕截取失败:%s" % e)
结果:
11111