You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chart.save(...) doesn't work with selenium 4.3.0 (released 2022/6/24), due to API deprecation
Detail
When I try to save chart in png or svg using chart.save(...), it fails like this
AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'
Full error trace
Traceback (most recent call last):
...
File "<REDACTED>.py", line 62, in main
chart.save("image.png")
File "<REDACTED>/lib/python3.8/site-packages/altair/vegalite/v4/api.py", line 488, in save
result = save(**kwds)
File "<REDACTED>/lib/python3.8/site-packages/altair/utils/save.py", line 116, in save
mimebundle = spec_to_mimebundle(
File "<REDACTED>/lib/python3.8/site-packages/altair/utils/mimebundle.py", line 60, in spec_to_mimebundle
return altair_saver.render(spec, format, mode=mode, **kwargs)
File "<REDACTED>/lib/python3.8/site-packages/altair_saver/_core.py", line 257, in render
mimebundle.update(saver.mimebundle(fmt))
File "<REDACTED>/lib/python3.8/site-packages/altair_saver/savers/_saver.py", line 90, in mimebundle
bundle[mimetype] = self._serialize(fmt, "mimebundle")
File "<REDACTED>/lib/python3.8/site-packages/altair_saver/savers/_selenium.py", line 284, in _serialize
out = self._extract(fmt)
File "<REDACTED>/lib/python3.8/site-packages/altair_saver/savers/_selenium.py", line 267, in _extract
driver.find_element_by_id("vis")
AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'
This stackoverflow answer was helpful to find why it fails:
Selenium 4.3.0
Deprecated find_element_by_* and find_elements_by_* are now removed (# 10712)
This is due to the altair_saver package, which uses find_element_by_id. There's a possible fix (see #105). As per #2624, the authors are waiting to fix this issue until the next package release.
For the moment try to use older versions of selenium.
TL;DR;
chart.save(...)
doesn't work withselenium 4.3.0
(released 2022/6/24), due to API deprecationDetail
When I try to save chart in png or svg using
chart.save(...)
, it fails like thisFull error trace
This stackoverflow answer was helpful to find why it fails:
selenium 4.3.0
released on 2022/6/24 https://github.com/SeleniumHQ/selenium/releases/tag/selenium-4.3.0Reproduction
I guess any
save()
call can reproduce it. For example, I can reproduce this issue with most simple example: 🔗save()
successful case:pip list
--
save()
failure case (with above error log):pip list
The text was updated successfully, but these errors were encountered: