Add support for max number of tries to get screenshots.