Skip to content

Fix incorrect A4 page size in Java PrintOptionsTest - #2767

Merged
diemol merged 2 commits into
trunkfrom
fix-a4-page-size-2753
Aug 11, 2026
Merged

Fix incorrect A4 page size in Java PrintOptionsTest#2767
diemol merged 2 commits into
trunkfrom
fix-a4-page-size-2753

Conversation

@diemol

@diemol diemol commented Aug 11, 2026

Copy link
Copy Markdown
Member

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

PrintOptionsTest.TestSize set the page size with new PageSize(27.94, 21.59) and labeled it "A4 size in cm". PageSize's constructor is (height, width), and 27.94 x 21.59 cm is actually PageSize.US_LETTER's dimensions, not A4 (real ISO A4 is 29.7 x 21.0 cm). This replaces the hardcoded, mislabeled values with the built-in PageSize.ISO_A4 constant (available since Selenium 4.47.0, which this repo's Java examples already depend on).

Motivation and Context

Fixes #2753 — the example code was silently teaching the wrong dimensions for A4 paper.

Types of changes

  • Code example added (and I also added the example to all translated languages)

No translated-language duplicates of this Java example exist for PrintOptionsTest's size test, and no docs line-number references shifted, so no other files needed updating.

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

This is a Java-example-only change with no docs/layout edits, so a Hugo render wasn't applicable here. Verified instead with mvn test -Dtest=PrintOptionsTest (7/7 passing).

new PageSize(27.94, 21.59) is actually PageSize.US_LETTER's dimensions
mislabeled as A4 (real A4 is 29.7x21.0 cm). Use the built-in
PageSize.ISO_A4 constant instead, available since Selenium 4.47.0.

Fixes #2753

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Fix A4 page size in Java PrintOptionsTest by using PageSize.ISO_A4

🐞 Bug fix 🧪 Tests 🕐 Less than 5 minutes

Grey Divider

AI Description

• Correct PrintOptionsTest page size to use true ISO A4 dimensions
• Replace mislabeled hardcoded US Letter values with PageSize.ISO_A4 constant
Diagram

graph TD
  A["PrintOptionsTest"] --> B["PrintOptions"] --> C["PageSize.ISO_A4"]
  B --> D["driver.print(...) (usage)"]
Loading
High-Level Assessment

Using the library-provided PageSize.ISO_A4 constant is the most reliable approach (avoids unit/order mistakes and improves readability) compared to hardcoding numeric dimensions.

Files changed (1) +1 / -1

Bug fix (1) +1 / -1
PrintOptionsTest.javaUse PageSize.ISO_A4 instead of incorrect hardcoded dimensions +1/-1

Use PageSize.ISO_A4 instead of incorrect hardcoded dimensions

• Replaces a hardcoded (and mislabeled) page size value with the built-in PageSize.ISO_A4 constant. This ensures the example/test uses actual A4 dimensions and avoids confusion with US Letter sizing.

examples/java/src/test/java/dev/selenium/interactions/PrintOptionsTest.java

@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for selenium-dev ready!

Name Link
🔨 Latest commit 4d369aa
🔍 Latest deploy log https://app.netlify.com/projects/selenium-dev/deploys/6a7a9463cfb5e80008dd761a
😎 Deploy Preview https://deploy-preview-2767--selenium-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

No code changes since the last review — review skipped

Qodo Logo

@diemol
diemol merged commit 1f6e07a into trunk Aug 11, 2026
8 checks passed
@diemol
diemol deleted the fix-a4-page-size-2753 branch August 11, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wrong a4 size

1 participant