Refactor amd driver download

This commit is contained in:
Manuel Thalmann 2023-07-15 20:42:25 +02:00
parent 9fd8ef86f5
commit a835cc95de

View file

@ -9,8 +9,23 @@ function Install-AmdSoftwarePackage() {
)
$tempDir = $context.GetTempDirectory();
$selector = '.os-group:first-of-type .driver:first-of-type a:first-of-type';
$file = Start-AutomatedDownload $context $url $selector $tempDir;
$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();
}
$browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click();
}
$file = Start-CustomDownload $context $url $action $tempDir;
Start-Process -Wait -FilePath $file -ArgumentList "/S";
Remove-Item -Recurse $tempDir;