-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix PrintOptions size example to replace setScale with setPageSize for A4 dimensions #2118
Conversation
👷 Deploy request for selenium-dev pending review.Visit the deploys page to approve it
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @yvsvarma !
Thank you very much @harsha509 for your time and effort in reviewing 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @yvsvarma ,
looks like tests are failing due to missing import import org.openqa.selenium.print.PageSize;
Could you please check and fix the test
Yes @harsha509, I too just noticed that. Will check and fix that Sri. |
0da6868
to
34da705
Compare
Hi @harsha509 , I have added the missing import and ran all the test cases and attached the logs here. Please review. Thanks, |
User description
Description
This pull request updates the PrintOptions size example in the Selenium documentation to use the correct API method. The previous example incorrectly demonstrated
setScale
, which is unrelated to setting the page size. The updated example now uses thesetPageSize
method with thePageSize
class, leveraging its constructor to set dimensions for A4 size (27.94 x 21.59 cm).This example also demonstrates how to retrieve the page height using
getPageSize().getHeight()
, and a comment has been added to guide users on retrieving the width withgetWidth()
if needed.Motivation and Context
This change addresses the issue raised in #2095, where the documentation incorrectly demonstrated the
setScale
method instead of showcasing the correctsetPageSize
functionality for the size example.The updated example:
Fixes the incorrect API usage (
setScale
) in the documentation.Aligns with the current Selenium 4.27.0 API, providing users with an accurate and functional reference.
Demonstrates the ability to set and retrieve dimensions for A4 size using the existing
PageSize
class.Note:
I have tested the example code locally, and it runs successfully. This commit addresses the fix for the Java example only. I will update the examples for other languages in the same PR once this review is complete.
PR Type
Bug fix, Documentation
Description
Replace incorrect setScale with proper setPageSize method
Implement A4 page dimensions using PageSize class
Add documentation for width/height retrieval methods
Changes walkthrough 📝
PrintOptionsTest.java
Fix PrintOptions size example with correct PageSize implementation
examples/java/src/test/java/dev/selenium/interactions/PrintOptionsTest.java
setScale
method withsetPageSize
for A4 dimensionsgetWidth()