From 0605d9bcb062f89b183282e9f8d829701dabf80a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 15 Aug 2024 02:42:00 +0200 Subject: [PATCH] Ensure website is loaded before download --- scripts/Common/Scripts/BrowserAutomation.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/Common/Scripts/BrowserAutomation.ps1 b/scripts/Common/Scripts/BrowserAutomation.ps1 index 1ea3f272..89b4b328 100644 --- a/scripts/Common/Scripts/BrowserAutomation.ps1 +++ b/scripts/Common/Scripts/BrowserAutomation.ps1 @@ -91,6 +91,10 @@ $null = New-Module { $browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options); $browser.Navigate().GoToUrl($URL); + while (-not ($browser.ExecuteScript("return document.readyState;") -eq "complete")) { + Start-Sleep 0.1; + } + try { $null = & $downloadAction -Browser $browser;