Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
selenium screenshot
#7
from selenium import webdriver

driver = webdriver.PhantomJS('/home/metulburr/phantomjs') #http://phantomjs.org/download.html
driver.set_window_size(1920,1080) 
driver.get('http://www.google.com')
driver.save_screenshot('out.png')
driver.quit()
where the path is to wherever the webdriver downloaded resides on your computer

out.png
   


Im sure you can get the element location, and crop the image to that location. Not sure exactly as i never had to do that before.
Recommended Tutorials:
Reply


Messages In This Thread
selenium screenshot - by hai001 - Feb-22-2017, 12:56 PM
RE: Code for website url and take screen shot of specific area on websire - by metulburr - Feb-22-2017, 03:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Taking screenshot ConsistentlyInconsistent 1 1,287 Sep-10-2023, 11:20 PM
Last Post: Larz60+
  Flask Can't Save Screenshot to Postgres Db firebird 3 2,505 Sep-21-2020, 09:22 PM
Last Post: firebird
  Store Screenshot Selenium + MongoDB Nuwan16 9 3,849 Aug-18-2020, 03:57 AM
Last Post: ndc85430
  Screenshot web page ! ABVSVL 3 3,509 Jul-11-2020, 01:39 PM
Last Post: snippsat
  screenshot arezoo 3 2,491 Apr-11-2020, 10:22 AM
Last Post: buran
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,807 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020