When I right-click on a page in my browser, I can "Save Page As", saving the entire webpage including images, css, and js. I've seen questions answered on downloading a page's content, but this only retrieves the HTML. Is there a solution with urllib2, requests, or any other library, to downloading the complete page?
You can use pyautogui
coupled with selenium
to achieve this.
import time
from selenium import webdriver
import pyautogui
URL = 'https://example.com'
# open page with selenium
# (first need to download Chrome webdriver, or a firefox webdriver, etc)
driver = webdriver.Chrome()
driver.get(URL)
# open 'Save as...' to save html and assets
pyautogui.hotkey('ctrl', 's')
time.sleep(1)
pyautogui.typewrite('your_filename' + '.html')
pyautogui.hotkey('enter')
Reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With