python+selenium实现截图多张照片,并保存到相应路径

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_44846959/article/details/100671098

截取一张照片:

driver.save_screenshot(“具体路径//error.png”)

截取多张照片,并保存:

current_time = time.strftime("%Y-%m-%d-%H_%M_%S", time.localtime(time.time()))
//获取系统当前时间,作为图片的命名格式
pic_path = ‘路径’ + current_time + ‘.png’
driver.save_screenshot(pic_path)

猜你喜欢

转载自blog.csdn.net/weixin_44846959/article/details/100671098