diff --git a/scripts/Common/Scripts/BrowserAutomation.ps1 b/scripts/Common/Scripts/BrowserAutomation.ps1 index 731d8072..5fd68768 100644 --- a/scripts/Common/Scripts/BrowserAutomation.ps1 +++ b/scripts/Common/Scripts/BrowserAutomation.ps1 @@ -127,12 +127,16 @@ $null = New-Module { .PARAMETER OutDir The directory to download the file to. + + .PARAMETER Timeout + The number of seconds to wait before clicking the download button. #> function Start-BrowserDownload { param( [string] $URL, [string] $ButtonSelector, - [string] $OutDir = $null + [string] $OutDir = $null, + [double] $Timeout = 0 ) Start-CustomBrowserDownload @PSBoundParameters -Action { @@ -153,8 +157,12 @@ $null = New-Module { } } + if ($Timeout -gt 0) { + Start-Sleep $Timeout; + } + if ($element) { - $Browser.FindElement([OpenQA.Selenium.By]::CssSelector($ButtonSelector)).Click(); + $Browser.FindElement($selector).Click(); } else { Write-Error "Unable to find download button!"; }