def _to_png(self, delay=<NUM_LIT:3>):
if self._png_image is None:<EOL><INDENT>from selenium import webdriver<EOL>options = webdriver.firefox.options.Options()<EOL>options.add_argument('<STR_LIT>')<EOL>driver = webdriver.Firefox(options=options)<EOL>html = self.get_root().render()<EOL>with _tmp_html(html) as fname:<EOL><INDENT>driver.get('<STR_LIT>'.format(path=fname))<EOL>driver.maximize_window()<EOL>time.sleep(delay)<EOL>png = driver.get_screenshot_as_png()<EOL>driver.quit()<EOL><DEDENT>self._png_image = png<EOL><DEDENT>return self._png_image<EOL>
Export the HTML to byte representation of a PNG image.

        Uses selenium to render the HTML and record a PNG. You may need to
        adjust the `delay` time keyword argument if maps render without data or tiles.

        Examples
        --------
        >>> m._to_png()
        >>> m._to_png(time=10)  # Wait 10 seconds between render and snapshot.