2023-07-15 18:22:51 +00:00
|
|
|
#!/bin/pwsh
|
2023-07-15 18:23:40 +00:00
|
|
|
. "$PSScriptRoot/Context.ps1";
|
2023-07-15 18:22:51 +00:00
|
|
|
. "$PSScriptRoot/BrowserAutomation.ps1";
|
|
|
|
|
|
|
|
function Install-AmdSoftwarePackage() {
|
|
|
|
param(
|
2023-07-15 18:23:40 +00:00
|
|
|
[Context] $context,
|
|
|
|
[string] $url
|
2023-07-15 18:22:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
$tempDir = $context.GetTempDirectory();
|
2023-07-15 19:03:22 +00:00
|
|
|
$cookieBannerSelector = "#onetrust-consent-sdk";
|
2023-07-15 18:42:25 +00:00
|
|
|
$osSelector = ".os-group:first-of-type";
|
|
|
|
$summarySelector = "$osSelector summary:first-of-type";
|
|
|
|
$downloadSelector = "$osSelector .driver:first-of-type a:first-of-type";
|
|
|
|
|
|
|
|
$action = {
|
|
|
|
param([OpenQA.Selenium.Firefox.FirefoxDriver] $browser)
|
|
|
|
|
|
|
|
$summary = $browser.FindElement([OpenQA.Selenium.By]::CssSelector($summarySelector));
|
|
|
|
|
|
|
|
if (-not ([bool]$summary.GetAttribute("aria-expanded"))) {
|
|
|
|
$summary.Click();
|
|
|
|
}
|
|
|
|
|
2023-07-15 19:05:37 +00:00
|
|
|
$downloader = {
|
|
|
|
param()
|
2023-07-15 19:03:22 +00:00
|
|
|
$browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click();
|
|
|
|
}
|
2023-07-15 19:05:37 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
$downloader.Invoke();
|
|
|
|
} catch {
|
|
|
|
$browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
|
|
|
|
$downloader.Invoke();
|
|
|
|
}
|
2023-07-15 18:42:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$file = Start-CustomDownload $context $url $action $tempDir;
|
2023-07-15 18:22:51 +00:00
|
|
|
|
|
|
|
Start-Process -Wait -FilePath $file -ArgumentList "/S";
|
|
|
|
Remove-Item -Recurse $tempDir;
|
|
|
|
}
|