Python+Selenium练习(三十一)- 截图并保存
目标:利用Selenium方法进行截图。在selenium for python中主要有三个截图方法,我们挑选其中最常用的一种。get_screenshot_as_file()
具体代码:
# coding = utf-8 import time from selenium import webdriver driver = webdriver.Chrome() driver.maximize_window() driver.implicitly_wait(6) driver.get("https://www.baidu.com") time.sleep(1) driver.get_screenshot_as_file("D:\\baidu.png") driver.quit()
运行结果:D盘会有一张百度首页截图
参考文章:https://blog.csdn.net/u011541946/article/details/70141488
相关推荐
xiangxiaojun 2020-09-23
Reiki 2020-08-16
letheashura 2020-08-14
tiankele0 2020-07-29
curiousL 2020-07-18
王练 2020-07-18
tiankele0 2020-07-18
amei0 2020-07-08
Reiki 2020-07-06
Ronnyxie 2020-07-06
xiangxiaojun 2020-07-05
zhanghaibing00 2020-06-28
xiongyouqiang 2020-06-28
Ronnyxie 2020-06-27
amei0 2020-06-26
letheashura 2020-06-26
tiankele0 2020-06-26
王练 2020-06-25