I need to take a screenshot of an entire web page. The important part here is that I need the screenshot to include the entire contents of the page that doesn't fit on the screen.
The data contains multiple lines (rows) of data and due to long length of data, it has a scroll bar. The number of lines vary every time and the screenshot should be based accordingly.
For long web pages that scroll, it is trivial to perform this task. But how can it be accomplished when data is big and gets under the scroll bar.
I would like to accomplish this using Python
. I am using the below code to capture the screenshot of the web page using Python.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = webdriver.ChromeOptions()
options.add_argument('headless')
options.add_argument('window-size=1440x1440')
driver = webdriver.Chrome(executable_path=os.path.abspath('C:/Program Files (x86)/Python36/selenium/chromedriver/build/scripts-3.6/chromedriver.exe'),chrome_options=options)
driver.get("https://www.test.com") ##updated as a random test URL
time.sleep(60);
driver.save_screenshot('C:/Users/Dev/Desktop/Maxx/Snapshots/test.png')
driver.quit
print ("captured snapshot")
Data on how it looks on the browser with scroll bar.