When I view the source of page, I do not find the image src. but the image is displayed on the page. This image is generated by some server side code.
I am using the selenium for testing. I want to download this image for verification/comparison.
How to get that image using python?
if you just want to download the image, theres two strategies you can try:

use a something like Firebug or Chrome developer tools.  right click the element in question, click "inspect element", and look at the css properties of the element.  if you look around, you should find something like background-image style or maybe just a normal  tag.  then you'll have the url to the image.
use a something like Firebug or Chrome developer tools:  look in the "resources" tab, and look for image files that show up.
How to get the URL Image which is displyed by script