[dotnet] Enhance PrintOptions class to support for predefined and cus… #15144
+79
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
PR Description
This PR implements the .NET version based on the original Java implementation: Original PR - Java.
The issue addressed in this PR revolves around the lack of predefined paper size options in the
PrintOptions
class for Selenium WebDriver in .NET. While the documentation suggests the ability to set commonly used paper sizes such as "A4," "Legal," and "Tabloid," the actual implementation lacked support for these features. This discrepancy created a usability gap and inconsistency with the expected functionality. The PR introduces predefined paper sizes, enhances usability through convenient methods, and aligns the .NET implementation with similar functionality in the Java WebDriver API.PR Type
Enhancement, Tests
Description
Added predefined paper sizes (A4, Legal, Letter, Tabloid) to
PrintOptions
.Introduced a default page size (A4) in the
PrintOptions
constructor.Added a method to set custom or predefined page sizes with validation.
Implemented unit tests for default, predefined, and custom page sizes.
Changes walkthrough 📝
PrintOptions.cs
Add predefined paper sizes and default A4 to PrintOptions
dotnet/src/webdriver/PrintOptions.cs
SetPageSize
method with null validation.PrintTest.cs
Add unit tests for PrintOptions page sizes
dotnet/test/common/PrintTest.cs