Allow invokation of custom downloads
This commit is contained in:
parent
981e6d739c
commit
d2f57c832a
1 changed files with 19 additions and 3 deletions
|
@ -12,11 +12,11 @@ if (-not ("OpenQA.Selenium.Firefox.FirefoxDriver" -as [type])) {
|
|||
[System.Reflection.Assembly]::Load($bytes);
|
||||
}
|
||||
|
||||
function Start-AutomatedDownload() {
|
||||
function Start-CustomDownload() {
|
||||
param(
|
||||
[Context] $context,
|
||||
[string] $url,
|
||||
[string] $buttonSelector,
|
||||
[Action[OpenQA.Selenium.Firefox.FirefoxDriver]] $action,
|
||||
[string] $outDir = $null
|
||||
)
|
||||
|
||||
|
@ -54,7 +54,7 @@ function Start-AutomatedDownload() {
|
|||
|
||||
$browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options);
|
||||
$browser.Navigate().GoToUrl($url);
|
||||
$browser.FindElement([OpenQA.Selenium.By]::CssSelector("$buttonSelector")).Click();
|
||||
$action.Invoke($browser);
|
||||
|
||||
while ($downloadChecker.Invoke()) {
|
||||
Write-Information "Waiting for download to finish...";
|
||||
|
@ -72,3 +72,19 @@ function Start-AutomatedDownload() {
|
|||
Remove-Item -Recurse $tempDir;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function Start-AutomatedDownload() {
|
||||
param(
|
||||
[Context] $context,
|
||||
[string] $url,
|
||||
[string] $buttonSelector,
|
||||
[string] $outDir = $null
|
||||
)
|
||||
|
||||
$action = {
|
||||
param([OpenQA.Selenium.Firefox.FirefoxDriver] $browser)
|
||||
$browser.FindElement([OpenQA.Selenium.By]::CssSelector("$buttonSelector")).Click();
|
||||
}
|
||||
|
||||
return Start-CustomDownload $context $url $action $outDir;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue