How to capture website screenshot in high resolution?
<p>I want to capture screenshot of a website in high resolution to recognize text  or simply to save high quality images. I tried this code in Python 2.7. The website <a href="http://www.flaticon.com/" rel="nofollow">http://www.flaticon.com/</a> has been taken merely as example.</p>

<pre><code>from selenium import webdriver
import time
driver = webdriver.PhantomJS()
#Setting large window size doesn`t resolve the problem
driver.set_window_size(16000, 12000)
driver.get('http://www.flaticon.com/')
time.sleep(3)
#set resolution 640 dots per inch for this image 
#???
driver.save_screenshot('./downloaded/img/welcome_icons.png') # save a screenshot to disk
driver.close()
</code></pre>

<p>It captures screenshot, but the resolution is not enough for me. Enlarging window size doesn`t resolve the problem. The picture from webside reside only on the part of the image. It seems that image resolution is not affected.
Is there some way to explicitly set image resolution before saving it?</p>

<p>If it is about changing window size, you can set it by</p>

<pre><code>driver.set_window_size(480, 320)
</code></pre>

<p>Here is an example of doing this from <a href="https://gist.github.com/jsok/9502024" rel="nofollow">Github</a> of one of the developers. As you can see, you can adjust both Window size and quality of the screenshot.</p>

<pre><code>import StringIO
from selenium import webdriver
from PIL import Image


# Install instructions
#
# npm install phantomjs
# sudo apt-get install libjpeg-dev
# pip install selenium pillow


driver = webdriver.PhantomJS(executable_path="node_modules/phantomjs/bin/phantomjs")
driver.set_window_size(1366, 728) # optional
driver.get('http://google.com')
driver.save_screenshot('screen_hires.png')

screen = driver.get_screenshot_as_png()

# Crop it back to the window size (it may be taller)
box = (0, 0, 1366, 728)
im = Image.open(StringIO.StringIO(screen))
region = im.crop(box)
region.save('screen_lores.jpg', 'JPEG', optimize=True, quality=95)
</code></pre>

<p>The quality of 100 is max, 0 - min.</p>

<p><strong>EDIT:</strong></p>

<p>You can also use <code>selenium.windowMaxmize()</code>.</p>

<p>And if you want to magnify the screen to see some specific texts as you said, you can try this in Mozilla:</p>

<pre><code>from selenium.webdriver.common.keys import Keys    

br = webdriver.Firefox()
zoom = ActionChains(br)
body = br.find_element_by_tag_name('body')
for i in range(2):
    zoom.send_keys_to_element(body,Keys.CONTROL,"+").perform()
</code></pre>

python selenium-webdriver