https://www.cnblogs.com/Mongol-J/p/12712492.html
https://npm.taobao.org/mirrors/chromedriver
1、pip install selenium
2、pip install chromedriver
3、下载chromedriver,确认好本机chrome对应的版本
http://chromedriver.storage.googleapis.com/index.html
4、代码如下:
1 import os 2 import shutil 3 from selenium import webdriver 4 import time 5 import random 6 7 try: 8 driver = webdriver.Chrome(r"D:\Download\chromedriver.exe") 9 picture_url = "https://www.baidu.com" 10 11 driver.get(picture_url) 12 driver.maximize_window() 13 14 print(dir(driver)) 15 16 time.sleep(1) 17 18 driver.get_screenshot_as_file('D:\\11.jpg') 19 print("%s:截图成功!!!" % picture_url) 20 driver.close() 21 except BaseException as msg: 22 print(msg)
Linux截图:
按照linux chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum install ./google-chrome-stable_current_x86_64.rpm
chmod +x chromedriver
移动端代码
https://blog.csdn.net/lylfv/article/details/106901541
pc端代码
https://blog.csdn.net/u012887259/article/details/103306861
截长图:
https://www.cnblogs.com/feibazhf/p/14337452.html