From 8b6f5d5e60a7045144f779b84f806c3783ba8167 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 5d04825c..1b3e1fc8 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;