Error TimeOut when making a screenshot of large page with Selenium (Python)

I have an error when i try to take a screenshot of a large image with Selenium and Python, with Chrome Driver.I tried a lot of thing since yesterday, but i have still the same error. I have the code to take a screenshot, but with a particular page (1050×8100),
i got the error selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: 299,800
The versions are ok ( i dont have any errors on other webpages)

Here are the options I’ve added (after reading several issues on stackoverflow) :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-setuid-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument('--hide-scrollbars')
chrome_options.add_argument("--force-device-scale-factor=1")
</code>
<code>chrome_options.add_argument('--headless') chrome_options.add_argument('--disable-gpu') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-setuid-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_argument("--start-maximized") chrome_options.add_argument('--hide-scrollbars') chrome_options.add_argument("--force-device-scale-factor=1") </code>
chrome_options.add_argument('--headless')  
chrome_options.add_argument('--disable-gpu')  
chrome_options.add_argument('--no-sandbox')  
chrome_options.add_argument('--disable-setuid-sandbox')  
chrome_options.add_argument('--disable-dev-shm-usage')  
chrome_options.add_argument("--start-maximized")  
chrome_options.add_argument('--hide-scrollbars')  
chrome_options.add_argument("--force-device-scale-factor=1")

And here is my code to take the screenshot :

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>self.driver.get(self.url)
page_width = self.driver.execute_script("return document.body.scrollWidth")
page_height = self.driver.execute_script("return document.body.scrollHeight") self.driver.set_window_size(page_width, page_height)
time.sleep(10)
png = self.driver.get_screenshot_as_png()
image = Image.open(io.BytesIO(png))
screen_path = os.path.join(folder_output_path, str(number_of_screen) + '.png') image.save(screen_path)
</code>
<code>self.driver.get(self.url) page_width = self.driver.execute_script("return document.body.scrollWidth") page_height = self.driver.execute_script("return document.body.scrollHeight") self.driver.set_window_size(page_width, page_height) time.sleep(10) png = self.driver.get_screenshot_as_png() image = Image.open(io.BytesIO(png)) screen_path = os.path.join(folder_output_path, str(number_of_screen) + '.png') image.save(screen_path) </code>
self.driver.get(self.url) 
page_width = self.driver.execute_script("return document.body.scrollWidth") 
page_height = self.driver.execute_script("return document.body.scrollHeight") self.driver.set_window_size(page_width, page_height) 
time.sleep(10) 
png = self.driver.get_screenshot_as_png() 
image = Image.open(io.BytesIO(png)) 
screen_path = os.path.join(folder_output_path, str(number_of_screen) + '.png') image.save(screen_path)

When I set the window size with smaller dimensions, it’s running, but I lost information from my page. For a page with:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>page_width=1560
</code>
<code>page_width=1560 </code>
page_width=1560

and

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>page_height=7351
</code>
<code>page_height=7351 </code>
page_height=7351

it’s running, but for page with (1560×8897) it’s not working.

Someone can help me to get the screenshot of the whole large page?

0

Try to reduce the image quality by adding the optimize and quality parameters, this should speed up saving the screenshot, e.g.:

image.save(screen_path, optimize=True, quality=80).

You can also try increasing the timeouts needed to load the page, e.g.

self.driver.set_page_load_timeout(120).

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật