File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,24 +300,27 @@ def _repr_html_(self, **kwargs):
300300 out = self ._parent ._repr_html_ (** kwargs )
301301 return out
302302
303- def _to_png (self , delay = 3 ):
303+ def _to_png (self , delay = 3 , driver = None ):
304304 """Export the HTML to byte representation of a PNG image.
305305
306306 Uses selenium to render the HTML and record a PNG. You may need to
307307 adjust the `delay` time keyword argument if maps render without data or tiles.
308308
309+ Uses a headless Firefox webdriver by default, though you can provide your own.
310+
309311 Examples
310312 --------
311313 >>> m._to_png()
312314 >>> m._to_png(time=10) # Wait 10 seconds between render and snapshot.
313315
314316 """
315317 if self ._png_image is None :
316- from selenium import webdriver
318+ if driver is None :
319+ from selenium import webdriver
317320
318- options = webdriver .firefox .options .Options ()
319- options .add_argument ('--headless' )
320- driver = webdriver .Firefox (options = options )
321+ options = webdriver .firefox .options .Options ()
322+ options .add_argument ('--headless' )
323+ driver = webdriver .Firefox (options = options )
321324
322325 html = self .get_root ().render ()
323326 with temp_html_filepath (html ) as fname :
You can’t perform that action at this time.
0 commit comments