Delete cookie banner only if necessary
This commit is contained in:
parent
cc8921ff73
commit
55ec81b4f0
1 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue