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 aren't seeing an actual image tag in the HTML, your next step would seem to be figuring out how its being displayed. 
The first place I'd suggest looking is in the .css files for this page. Images can actually be embedded using CSS, and this seems like the next likely option after being in the HTML code itself.
If it isn't in there, you may be dealing with some form of technique deliberately intended to prevent you from being able to download the image with a script. This may use obfuscated JavaScript or something similar and I wouldn't expect people to be able to give you an easy solution to bypass it (since it was carefully designed to resist exactly that).
How to get the URL Image which is displyed by script