This commit is contained in:
2025-12-02 11:02:24 +00:00
parent e29d104d47
commit 4c624d7e29
7 changed files with 76 additions and 45 deletions

View File

@@ -106,8 +106,6 @@ namespace AiQ_GUI
// Initialises and opens a ChromeDriver with specific options
public static ChromeDriver OpenDriver()
{
string tempProfile = null;
try
{
ChromeOptions options = new();
@@ -121,7 +119,7 @@ namespace AiQ_GUI
"--disable-features=BrowserAddPersonFeature,InterestFeedContentSuggestions");
// Use a unique temporary profile to avoid conflicts
tempProfile = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
string tempProfile = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
options.AddArguments($"--user-data-dir={tempProfile}");
// manual driver path

View File

@@ -7,8 +7,9 @@ namespace AiQ_GUI
internal class SoakTest
{
// Main soak test loop: Randomise dropdowns, run luminance test every hour, power cycle at 7am
public static async Task StartSoak(Camera CamInfo, CheckBox CkBx, CancellationToken token)
public static async Task StartSoak(Camera CamInfo, CancellationTokenSource CTS)
{
CancellationToken token = CTS.Token;
if (CamInfo.Serial == "N/A")
CamInfo.Serial = "UNKNOWN"; // If serial is not set, set it to UNKNOWN. Cannot have N/A in file names.
@@ -18,6 +19,7 @@ namespace AiQ_GUI
try
{
driver = Selenium.OpenDriver();
Logging.LogMessage("----- Soak test started -----", SoakLogFile);
await Task.Delay(1000); // Small delay to ensure driver is ready
// Keep retrying until connected or cancelled
@@ -58,6 +60,16 @@ namespace AiQ_GUI
while (!token.IsCancellationRequested)
{
try
{
string TheString = "Selenium string: " + driver.Manage().Window.Size; // Fails out if Window doesn't exist.
}
catch
{
CTS.Cancel();
continue;
}
int currentHour = DateTime.Now.Hour;
// At 7am, power cycle the camera