Skip to content

Commit 34da705

Browse files
committed
Fix PrintOptions size example to replace setScale with setPageSize for A4 dimensions
1 parent ef7d1c6 commit 34da705

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: examples/java/src/test/java/dev/selenium/interactions/PrintOptionsTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.junit.jupiter.api.Test;
44
import org.openqa.selenium.print.PageMargin;
55
import org.openqa.selenium.print.PrintOptions;
6-
6+
import org.openqa.selenium.print.PageSize;
77
import dev.selenium.BaseChromeTest;
88

99
public class PrintOptionsTest extends BaseChromeTest {
@@ -31,8 +31,8 @@ public void TestSize()
3131
{
3232
driver.get("https://www.selenium.dev/");
3333
PrintOptions printOptions = new PrintOptions();
34-
printOptions.setScale(.50);
35-
double current_scale = printOptions.getScale();
34+
printOptions.setPageSize(new PageSize(27.94, 21.59)); // A4 size in cm
35+
double currentHeight = printOptions.getPageSize().getHeight(); // use getWidth() to retrieve width
3636
}
3737

3838
@Test

0 commit comments

Comments
 (0)