Skip to content

Commit 0e0f1a4

Browse files
committed
Allow headless download to default path, with better variable name
1 parent dd25664 commit 0e0f1a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Selenium.psm1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ function Start-SeChrome {
114114

115115
}
116116

117+
if($Headless -and $DefaultDownloadPath) {
118+
$HeadlessDownloadParams = New-Object 'system.collections.generic.dictionary[[System.String],[System.Object]]]'
119+
$HeadlessDownloadParams.Add('behavior', 'allow')
120+
$HeadlessDownloadParams.Add('downloadPath', $DefaultDownloadPath.FullName)
121+
122+
$Driver.ExecuteChromeCommand('Page.setDownloadBehavior', $HeadlessDownloadParams)
123+
}
124+
117125
if($StartURL){
118126
Enter-SeUrl -Driver $Driver -Url $StartURL
119127
}

0 commit comments

Comments
 (0)