Try deleting cookie banner in case of an error

This commit is contained in:
Manuel Thalmann 2023-07-15 21:05:37 +02:00
parent 55ec81b4f0
commit d50b9e97b3

View file

@ -23,11 +23,17 @@ function Install-AmdSoftwarePackage() {
$summary.Click();
}
if (($browser.FindElements([OpenQA.Selenium.By]::CssSelector($cookieBannerSelector))).Count -gt 0) {
$browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
} else {
$downloader = {
param()
$browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click();
}
try {
$downloader.Invoke();
} catch {
$browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
$downloader.Invoke();
}
}
$file = Start-CustomDownload $context $url $action $tempDir;