selenium之截图
生活随笔
收集整理的這篇文章主要介紹了
selenium之截图
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
selenium支持對當前頁面保存截圖,使用方法:
driver.get_screenshot_as_file(file_path)?代碼舉例:
...... def get_screenshot(driver, path=''):'''保存頁面截圖'''n = 0if path:passelse:path = "D:\\test_data\\screenshot\\error_png.png"'''檢查文件是否已存在'''while (os.path.exists(path)):# print("文件已存在:" + path)n += 1path = "D:\\test_data\\screenshot\\error_png" + str(n) + ".png"driver.get_screenshot_as_file(path) # 保存截圖driver.implicitly_wait(2)print("已保存截圖,路徑為:" + path) ......?
轉載于:https://www.cnblogs.com/gongxr/p/7266067.html
總結
以上是生活随笔為你收集整理的selenium之截图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux下基于C/C++的Socket
- 下一篇: 财务数据图表分析,这些财务预算表模板免费