先执行shell: # https://intoli.com/install-google-chrome.sh wget https://s.zhusl.com/chromedriver/install-google-chrome.sh bash install-google-chrome.sh ## 下载chromedriver 下载地址如下,需要和上面安装的版本保持一致: https://npm.taobao.org/mirrors/chromedriver/ wget https://npm.taobao.org/mirrors/chromedriver/81.0.4044.138/chromedriver_linux64.zip unzip chromedriver_linux64.zip mv chromedriver /usr/bin ## python使用可能需要结合selenium ``` # 一个获取网页快照保存图片函数示例 def poster_windows(url,save_path,logger,width,height,poster_type,filename): ob = Screenshot_Clipping.Screenshot() chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_argument('--headless') chrome_options.add_argument("--no-sandbox") driver = webdriver.Chrome(chrome_options=chrome_options) driver.set_window_size(width, height) driver.get(url) time.sleep(5) img_path = ob.full_Screenshot(driver, save_path=save_path, image_name='{}.png'.format(filename)) driver.close() driver.quit() return img_path ```