Save multiple charts with same selenium instance
See original GitHub issueOne of the benefits that lead me to altair was the ability to generate vega-lite json that can be used in the to generate and save charts locally and in the browser. I’ve been able to save via the browser and locally.
Viewing and saving in the browser is nice for single charts. Saving locally is nice for saving a lot of charts programically (~50 charts). When saving locally altiar launches a selenium instance and a session to render and save the chart. This can be a little slow.
To reuse the selenium resources as much as possible, is there a way I can save multiple charts at once? Something like this would satisfy my desire for a small speed increase:
alt.save(*chart_list)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (7 by maintainers)
Top Results From Across the Web
How to scrape multiple pages using Selenium in Python?
Here, In this article, we are going to discuss how to scrap multiple pages using selenium. There can be many ways for scraping...
Read more >📶 Chart Maker - SeleniumBase Docs
SeleniumBase ChartMaker lets you use Python to generate HTML charts. (Click to see a presentation with multiple charts). Here's how to run a...
Read more >Altair automatic save chart using selenium chromedriver
With it, you can pass a custom driver instance to the save method: ... save(chart, "chart.png", method='selenium', webdriver=driver).
Read more >Automate Complex Graphs with Selenium - YouTube
In this video, I have explained how to automate complex Graphs with SVG elements.~~~Subscribe to this channel, and press bell icon to get ......
Read more >Automating report generation using Selenium Webdriver
If you need to automate the generation of chart images or PDF, Selenium Webdriver might be the best option. It can handle different...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is now implemented automatically in http://github.com/altair-viz/altair_saver. I plan to remove all selenium-based code from Altair itself, and require installation of
altiar_saver
for programmatic saving of PNG, SVG, and PDF.Apologies for waking up this thread, but since no solution was implemented in altair yet (as far as I can tell), I would like to point out that there’s a good opportunity to get two scoops in one cone here. I propose allowing
Chart.save()
to receive an initialized selenium webdriver instance instead of a string. This way one can reuse the same webdriver over multiple saves, avoiding the overhead ofsave()
initializing a new one each time:I think this might be a cleaner solution (API-wise) from altair’s point of view, as it avoids complicated user inputs, such as specifying lists/tuples of charts, file-names, and keyword-arguments.
As for the two-for-one: The other benefit of such a solution is that it also solves https://github.com/altair-viz/altair/issues/1619 and allows users greater freedom in how they set their work environment (for example, working on remote machines where one may not have permissions to
PATH
or/bin
in order to point to webdriver executables. Users can specify arbitrary locations when initializing the driver:webdriver.Chrome('path/to/webdriver.exe)
).