|
| 1 | +package dev.selenium.interactions; |
| 2 | + |
| 3 | +import org.junit.jupiter.api.Test; |
| 4 | +import org.openqa.selenium.print.PageMargin; |
| 5 | +import org.openqa.selenium.print.PrintOptions; |
| 6 | + |
| 7 | +import dev.selenium.BaseChromeTest; |
| 8 | + |
| 9 | +public class PrintOptionsTest extends BaseChromeTest { |
| 10 | + |
| 11 | + @Test |
| 12 | + public void TestOrientation() |
| 13 | + { |
| 14 | + driver.get("https://www.selenium.dev/"); |
| 15 | + PrintOptions printOptions = new PrintOptions(); |
| 16 | + printOptions.setOrientation(PrintOptions.Orientation.LANDSCAPE); |
| 17 | + PrintOptions.Orientation current_orientation = printOptions.getOrientation(); |
| 18 | + } |
| 19 | + |
| 20 | + @Test |
| 21 | + public void TestRange() |
| 22 | + { |
| 23 | + driver.get("https://www.selenium.dev/"); |
| 24 | + PrintOptions printOptions = new PrintOptions(); |
| 25 | + printOptions.setPageRanges("1-2"); |
| 26 | + String[] current_range = printOptions.getPageRanges(); |
| 27 | + } |
| 28 | + |
| 29 | + @Test |
| 30 | + public void TestSize() |
| 31 | + { |
| 32 | + driver.get("https://www.selenium.dev/"); |
| 33 | + PrintOptions printOptions = new PrintOptions(); |
| 34 | + printOptions.setScale(.50); |
| 35 | + double current_scale = printOptions.getScale(); |
| 36 | + } |
| 37 | + |
| 38 | + @Test |
| 39 | + public void TestMargins() |
| 40 | + { |
| 41 | + driver.get("https://www.selenium.dev/"); |
| 42 | + PrintOptions printOptions = new PrintOptions(); |
| 43 | + PageMargin margins = new PageMargin(1.0,1.0,1.0,1.0); |
| 44 | + printOptions.setPageMargin(margins); |
| 45 | + double topMargin = margins.getTop(); |
| 46 | + double bottomMargin = margins.getBottom(); |
| 47 | + double leftMargin = margins.getLeft(); |
| 48 | + double rightMargin = margins.getRight(); |
| 49 | + } |
| 50 | + |
| 51 | + @Test |
| 52 | + public void TestScale() |
| 53 | + { |
| 54 | + driver.get("https://www.selenium.dev/"); |
| 55 | + PrintOptions printOptions = new PrintOptions(); |
| 56 | + printOptions.setScale(.50); |
| 57 | + double current_scale = printOptions.getScale(); |
| 58 | + } |
| 59 | + |
| 60 | + @Test |
| 61 | + public void TestBackground() |
| 62 | + { |
| 63 | + driver.get("https://www.selenium.dev/"); |
| 64 | + PrintOptions printOptions = new PrintOptions(); |
| 65 | + printOptions.setBackground(true); |
| 66 | + boolean current_background = printOptions.getBackground(); |
| 67 | + } |
| 68 | + |
| 69 | + @Test |
| 70 | + public void TestShrinkToFit() |
| 71 | + { |
| 72 | + driver.get("https://www.selenium.dev/"); |
| 73 | + PrintOptions printOptions = new PrintOptions(); |
| 74 | + printOptions.setShrinkToFit(true); |
| 75 | + boolean current_shrink_to_fit = printOptions.getShrinkToFit(); |
| 76 | + } |
| 77 | +} |
0 commit comments