Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendered table has a missing last row with Chrome webdriver #424

Open
2 tasks done
HagaiHargil opened this issue Aug 30, 2024 · 4 comments
Open
2 tasks done

Rendered table has a missing last row with Chrome webdriver #424

HagaiHargil opened this issue Aug 30, 2024 · 4 comments

Comments

@HagaiHargil
Copy link

HagaiHargil commented Aug 30, 2024

Prework

Description

Hi,

GT has been great so far - thanks! Recently, the tables it outputs have a semi-missing last line:

Screenshot 2024-08-30 150555

(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:

  1. The HTML output (as_raw_html()) outputs the correct table.
  2. Using either a Polars or Pandas DF doesn't change anything.
  3. The window_size parameter doesn't change anything.
  4. I tried changing htmltools versions, as well as selenium and PIL, but that didn't help either.
  5. There are no warnings that pop up in the console during runtime.
  6. Running on week-old data that produced perfect tables now fails.
  7. Changing output types to jpg and pdf doesn'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
@machow
Copy link
Collaborator

machow commented Aug 30, 2024

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)

image

@HagaiHargil
Copy link
Author

Thanks for the quick work and super-fast release!

Sadly, the issue is now that the table is seen in a "zoomed out" version:

image

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!

@machow
Copy link
Collaborator

machow commented Sep 9, 2024

Shoot -- do you mind posting your chrome version? I can look a bit more, since chrome is a fairly popular choice 😬

@HagaiHargil
Copy link
Author

On Windows it's 128.0.6613.120.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants