webdriver提供了截图函数get_screenshot_as_file(本地路径和图片命名)来截取当前创窗口。例如:
#截取当前窗口,指定截图图片的保存位置
driver.get_screenshot_as_file(r"C:UsersfyrDesktop123.jpg")