-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Cs Print Options Examples (#1993)[deploy site]
* Fixed Incorrect Example Lines in PrintOptions Page * Added C# PrintOptions Examples --------- Co-authored-by: Sri Harsha <[email protected]>
- Loading branch information
Showing
5 changed files
with
109 additions
and
56 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
examples/dotnet/SeleniumDocs/Interactions/PrintOptionsTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
|
||
namespace SeleniumDocumentation.SeleniumInteractions | ||
{ | ||
[TestClass] | ||
public class PrintOptionsTest | ||
{ | ||
[TestMethod] | ||
public void TestOrientation() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Navigate().GoToUrl("https://selenium.dev"); | ||
PrintOptions printOptions = new PrintOptions(); | ||
printOptions.Orientation = PrintOrientation.Landscape; | ||
PrintOrientation currentOrientation = printOptions.Orientation; | ||
} | ||
|
||
[TestMethod] | ||
public void TestRange() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Navigate().GoToUrl("https://selenium.dev"); | ||
PrintOptions printOptions = new PrintOptions(); | ||
printOptions.AddPageRangeToPrint("1-3"); // add range of pages | ||
printOptions.AddPageToPrint(5); // add individual page | ||
} | ||
|
||
[TestMethod] | ||
public void TestSize() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/"); | ||
PrintOptions printOptions = new PrintOptions(); | ||
PrintOptions.PageSize currentDimensions = printOptions.PageDimensions; | ||
} | ||
|
||
[TestMethod] | ||
public void TestBackgrounds() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/"); | ||
PrintOptions printOptions = new PrintOptions(); | ||
printOptions.OutputBackgroundImages = true; | ||
bool currentBackgrounds = printOptions.OutputBackgroundImages; | ||
} | ||
|
||
[TestMethod] | ||
public void TestMargins() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/"); | ||
PrintOptions printOptions = new PrintOptions(); | ||
PrintOptions.Margins currentMargins = printOptions.PageMargins; | ||
} | ||
|
||
|
||
[TestMethod] | ||
public void TestScale() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/"); | ||
PrintOptions printOptions = new PrintOptions(); | ||
printOptions.ScaleFactor = 0.5; | ||
double currentScale = printOptions.ScaleFactor; | ||
} | ||
|
||
[TestMethod] | ||
public void TestShrinkToFit() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/"); | ||
PrintOptions printOptions = new PrintOptions(); | ||
printOptions.ShrinkToFit = true; | ||
bool currentShrinkToFit = printOptions.ShrinkToFit; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.