great-tables
great-tables copied to clipboard
Rendered table has a missing last row with Chrome webdriver
Prework
- [X] Read and agree to the code of conduct and contributing guidelines.
- [X] If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
Description
Hi,
GT has been great so far - thanks! Recently, the tables it outputs have a semi-missing last line:
(I cut the upper half of the image since the data is sensitive)
This is the last row of the table - and you can also see that the table "knows" that it's the last one since the image ends a bit below that. This happens on Windows and Linux (WSL).
Reproducible example
The code I'm running is a simple GT(df)...save(fname) (see below) and as I said it worked until a week ago. Sadly - I have no idea what has changed. git diff doesn't provide any clues, but regardless the code and data are still legit in the sense that they should be rendered correctly.
I was somehow able to make Firefox run on this work laptop (inside Docker) and saw that changing web_driver to firefox solves the issue, but still not having it work on Chrome (the default) on both Windows and Linux feels worthy of a bug report (and annoys me slightly).
table = (
GT(df)
.tab_header(title=title + " (values in um)", subtitle=subtitle)
.tab_stub(rowname_col="Radius")
.tab_stubhead(label="Radius range")
.cols_label(
errors_x="X Mean Error",
std_err_x="X St. Dev.",
errors_y="Y Mean Error",
std_err_y="Y St. Dev.",
)
.tab_spanner(label="X", columns=["errors_x", "std_err_x", "X 99% Rep."])
.tab_spanner(label="Y", columns=["errors_y", "std_err_y", "Y 99% Rep."])
# .fmt_number(["std_err", "mean_err"], decimals=2) # unicode error, unrelated to this issue
)
table.save("table.png", web_driver="firefox") # "chrome" fails
These are things that I checked:
- The HTML output (
as_raw_html()) outputs the correct table. - Using either a Polars or Pandas DF doesn't change anything.
- The
window_sizeparameter doesn't change anything. - I tried changing
htmltoolsversions, as well asseleniumandPIL, but that didn't help either. - There are no warnings that pop up in the console during runtime.
- Running on week-old data that produced perfect tables now fails.
- Changing output types to
jpgandpdfdoesn't help.
I'm sorry I can't provide a real reproducible example - I really have no idea what was changed. Instead, I'd be happy if you would point me at other angles that I haven't covered in my search.
Thanks again!
Development environment
- Operating System: Windows and Linux
- great_tables Version: 0.10.0
Shoot, it looks like the issue is that we need to resize the browser to capture the table, but resizing sets the browser outerHeight (the full browser, including topbar etc..). I'm guessing something about the outer size changed. I think we can tweak it so it accounts for the outer part better...
(Here's an image showing the outer and inner heights in the bottom right console, after I resized it to 1000)
Thanks for the quick work and super-fast release!
Sadly, the issue is now that the table is seen in a "zoomed out" version:
The last row appears properly, but this is obviously the wrong "crop". The firefox web driver still works flawless, and changing window_size this time does decrease the window size, so theoretically I can pick the exact pixel size that will fit a given table.
This is true for Windows and Linux.
Thanks again for the help!
Shoot -- do you mind posting your chrome version? I can look a bit more, since chrome is a fairly popular choice 😬
On Windows it's 128.0.6613.120.