Skip to content

Commit 3c9827e

Browse files
committed
Quitting the browser when the test is over.
1 parent c0770f2 commit 3c9827e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

examples/dotnet/SeleniumDocs/Interactions/PrintOptionsTest.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public void TestOrientation()
1616
PrintOptions printOptions = new PrintOptions();
1717
printOptions.Orientation = PrintOrientation.Landscape;
1818
PrintOrientation currentOrientation = printOptions.Orientation;
19+
driver.Quit();
1920
}
2021

2122
[TestMethod]
@@ -26,7 +27,8 @@ public void TestRange()
2627
PrintOptions printOptions = new PrintOptions();
2728
printOptions.AddPageRangeToPrint("1-3"); // add range of pages
2829
printOptions.AddPageToPrint(5); // add individual page
29-
}
30+
driver.Quit();
31+
}
3032

3133
[TestMethod]
3234
public void TestSize()
@@ -35,6 +37,7 @@ public void TestSize()
3537
driver.Navigate().GoToUrl("https://www.selenium.dev/");
3638
PrintOptions printOptions = new PrintOptions();
3739
PrintOptions.PageSize currentDimensions = printOptions.PageDimensions;
40+
driver.Quit();
3841
}
3942

4043
[TestMethod]
@@ -45,6 +48,7 @@ public void TestBackgrounds()
4548
PrintOptions printOptions = new PrintOptions();
4649
printOptions.OutputBackgroundImages = true;
4750
bool currentBackgrounds = printOptions.OutputBackgroundImages;
51+
driver.Quit();
4852
}
4953

5054
[TestMethod]
@@ -54,6 +58,7 @@ public void TestMargins()
5458
driver.Navigate().GoToUrl("https://www.selenium.dev/");
5559
PrintOptions printOptions = new PrintOptions();
5660
PrintOptions.Margins currentMargins = printOptions.PageMargins;
61+
driver.Quit();
5762
}
5863

5964

@@ -65,6 +70,7 @@ public void TestScale()
6570
PrintOptions printOptions = new PrintOptions();
6671
printOptions.ScaleFactor = 0.5;
6772
double currentScale = printOptions.ScaleFactor;
73+
driver.Quit();
6874
}
6975

7076
[TestMethod]
@@ -75,16 +81,18 @@ public void TestShrinkToFit()
7581
PrintOptions printOptions = new PrintOptions();
7682
printOptions.ShrinkToFit = true;
7783
bool currentShrinkToFit = printOptions.ShrinkToFit;
84+
driver.Quit();
7885
}
7986

8087
[TestMethod]
81-
public void PrintWithPrintsPageTest()
88+
public void PrintWithPrintsPageTest()
8289
{
8390
WebDriver driver = new ChromeDriver();
8491
driver.Navigate().GoToUrl("https://www.selenium.dev/");
8592
PrintOptions printOptions = new PrintOptions();
8693
PrintDocument printedPage = driver.Print(printOptions);
8794
Assert.IsTrue(printedPage.AsBase64EncodedString.StartsWith("JVBER"));
95+
driver.Quit();
8896
}
8997
}
90-
}
98+
}

0 commit comments

Comments
 (0)