diff --git a/scripts/Windows/Scripts/AmdSoftwarePackage.ps1 b/scripts/Windows/Scripts/AmdSoftwarePackage.ps1 index d2043cbb..ecf71b8e 100644 --- a/scripts/Windows/Scripts/AmdSoftwarePackage.ps1 +++ b/scripts/Windows/Scripts/AmdSoftwarePackage.ps1 @@ -9,6 +9,7 @@ function Install-AmdSoftwarePackage() { ) $tempDir = $context.GetTempDirectory(); + $cookieBannerSelector = "#onetrust-consent-sdk"; $osSelector = ".os-group:first-of-type"; $summarySelector = "$osSelector summary:first-of-type"; $downloadSelector = "$osSelector .driver:first-of-type a:first-of-type"; @@ -22,9 +23,11 @@ function Install-AmdSoftwarePackage() { $summary.Click(); } - Start-Sleep 10; - $browser.ExecuteScript("document.querySelector('#onetrust-consent-sdk').remove()"); - $browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click(); + if (($browser.FindElements([OpenQA.Selenium.By]::CssSelector($cookieBannerSelector))).Count -gt 0) { + $browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()"); + } else { + $browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click(); + } } $file = Start-CustomDownload $context $url $action $tempDir;