Skip to content

Commit b3623a8

Browse files
committed
Added Start Maximized to Start-SeChrome and added additional testing.
1 parent 02792fb commit b3623a8

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

Selenium.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ function Start-SeChrome {
1616
[System.IO.FileInfo]$DefaultDownloadPath,
1717
[bool]$DisableBuiltInPDFViewer=$true,
1818
[switch]$Headless,
19-
[switch]$Incognito
19+
[switch]$Incognito,
20+
[switch]$Maximized
2021
)
2122

2223
$Chrome_Options = New-Object -TypeName "OpenQA.Selenium.Chrome.ChromeOptions"
@@ -38,6 +39,10 @@ function Start-SeChrome {
3839
$Chrome_Options.AddArguments('Incognito')
3940
}
4041

42+
if ($Maximized) {
43+
$Chrome_Options.AddArguments('start-maximized')
44+
}
45+
4146
if ($Arguments) {
4247
$Chrome_Options.AddArguments($Arguments)
4348
}

Selenium.tests.ps1

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,27 @@ Describe "Start-SeChrome headless" {
7777
}
7878
}
7979

80-
Describe "Start-SeChrome incognito" {
81-
Context "Should Start Chrome Driver in headless mode" {
82-
$Driver = Start-SeChrome -Incognito
83-
Stop-SeDriver $Driver
80+
Describe "Start-SeChrome with Options" {
81+
Context "Should Start Chrome Driver with different startup options" {
82+
It "Start Chrome in Headless mode"{
83+
$Driver = Start-SeChrome -Headless
84+
Stop-SeDriver $Driver
85+
}
86+
87+
It "Start Chrome Maximized "{
88+
$Driver = Start-SeChrome -Maximized
89+
Stop-SeDriver $Driver
90+
}
91+
92+
It "Start Chrome Incognito "{
93+
$Driver = Start-SeChrome -Incognito
94+
Stop-SeDriver $Driver
95+
}
96+
97+
It "Start Chrome Maximized and Incognito "{
98+
$Driver = Start-SeChrome -Maximized -Incognito
99+
Stop-SeDriver $Driver
100+
}
84101
}
85102
}
86103

0 commit comments

Comments
 (0)