How to write text on screenshots

By | April 29, 2016

When test automation takes a lot of screenshots, it’s very important to keep track of them. Usually a test report has links to related screenshots. There is no problem to trace a failed test case to its screenshots. However, when an engineer looks at a screenshot, can the screenshot tell the engineer some essential information such as time stamp, test case ID, or other network information?

Writing textual info on screenshots can be helpful sometimes. The Python module pillow is quite handy for this. If the module has not been installed, use the following command to install it.

The following code snippet shows how to write text on an image. It can be integrated into a test framework. Whenever a screenshot is taken, some essential info can be written on the image.


Leave a Reply

Your email address will not be published. Required fields are marked *