Skip to content

Commit 44584fe

Browse files
chore: merge selenium fix
2 parents 32511e7 + b8c6137 commit 44584fe

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/ci-plottest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ jobs:
6666
echo "📦 Installing: uv sync $EXTRAS"
6767
uv sync $EXTRAS
6868
69-
- name: Setup Chrome for Highcharts
70-
if: steps.detect_libs.outputs.has_plots == 'true' && contains(steps.detect_libs.outputs.libraries, 'highcharts')
69+
- name: Setup Chrome for Selenium-based libraries
70+
if: steps.detect_libs.outputs.has_plots == 'true' && (contains(steps.detect_libs.outputs.libraries, 'highcharts') || contains(steps.detect_libs.outputs.libraries, 'bokeh'))
7171
uses: browser-actions/setup-chrome@v1
7272
with:
7373
chrome-version: stable

plots/highcharts/scatter/scatter-basic/default.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from highcharts_core.chart import Chart
1313
from highcharts_core.options import HighchartsOptions
1414
from highcharts_core.options.series.scatter import ScatterSeries
15+
from PIL import Image
1516
from selenium import webdriver
1617
from selenium.webdriver.chrome.options import Options
1718

@@ -98,9 +99,14 @@
9899
driver.get(f"file://{temp_path}")
99100
time.sleep(5)
100101

101-
# Screenshot the container element directly for exact dimensions
102-
container = driver.find_element("id", "container")
103-
container.screenshot("plot.png")
102+
# Screenshot the full window and crop to exact dimensions
103+
driver.save_screenshot("plot_raw.png")
104104
driver.quit()
105105

106+
# Crop to exact dimensions (4800 x 2700)
107+
with Image.open("plot_raw.png") as img:
108+
cropped = img.crop((0, 0, 4800, 2700))
109+
cropped.save("plot.png")
110+
Path("plot_raw.png").unlink()
111+
106112
Path(temp_path).unlink()

plots/matplotlib/scatter/scatter-basic/default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# Create plot
1616
fig, ax = plt.subplots(figsize=(16, 9))
17-
ax.scatter(x, y, alpha=0.7, s=50, color="#306998")
17+
ax.scatter(x, y, alpha=0.7, s=80, color="#306998")
1818

1919
# Labels and styling
2020
ax.set_xlabel("X Value", fontsize=20)

0 commit comments

Comments
 (0)