![]() ![]() # The width is hardcoded because the screensize is fixed for each computerīt_window_size(1920, total_height) # Set the window size - what is the size of our screenshot ![]() # Get the height of the element, and adding some height just to be sage # We try to get the top-level component in which all out page is its childrenĮlem = browser.find_element_by_id('main-layout-content') # We go to the webpage here and wait 2 seconds for fully load Here is what I did to get the full-size screenshot of a webpage from selenium import webdriver ![]() Note that screenshot can take only 10000 of height of website, You can scale to 100 in order to capture full height Take screenshot of full web page with Selenium Python with Chrome driver With that object you can use ob.full_Screenshot in order to capture full screenĬheckout PythonFullPageScreenShot project on Github for full source code Then create an object of Screenshot: ob=Screenshot_Clipping.Screenshot() Just run this command in python3 pip install Selenium-Screenshot You can use Screenshot_Clipping in order to scroll the page and take screenshot from each scroll. Selenium does not take the screenshot of the whole website, when its not headless ![]() #coding=utf-8įrom import OptionsĬhrome_options.add_argument('-headless')Ĭhrome_options.add_argument('-start-maximized')ĭriver = webdriver.Chrome(chrome_options=chrome_options)Įle=driver.find_element("xpath", layout"]')ĭt_window_size(1920, total_height) #the trickĭriver.save_screenshot("screenshot1.png") How it works: set browser height as longest as you can. Take screenshot of full page with Selenium Python with chromedriver ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |