- AddToActionsList(Level.DEBUG) method has been changed to only visible when ChBXDevLog is true to avoid DEVS always having it on.

- added Level.DEBUG logs throughout selenium and soak test. Due to having prior issues with selenium and Soaktest
- Bug fix in LDS.cs this stops a crossthread exception as its trying to write to AddToActionsList before it loads.
This commit is contained in:
2026-01-16 11:42:34 +00:00
parent 4dace8edef
commit 8770469fd4
5 changed files with 75 additions and 7 deletions

View File

@@ -15,6 +15,7 @@ namespace AiQ_GUI
string SoakLogFile = $"SoakLog_{CamInfo.Serial}_{CamInfo.Model}.log";
ChromeDriver driver = null;
MainForm.Instance.AddToActionsList($"Soak test started for {CamInfo.Serial} ({CamInfo.Model}) at {CamInfo.IP}", Level.DEBUG);
try
{
@@ -24,18 +25,22 @@ namespace AiQ_GUI
// Keep retrying until connected or cancelled
bool connected = false;
int attemptCount = 0;
while (!connected && !token.IsCancellationRequested)
{
try
{
attemptCount++;
// Attempt initial connection and navigation to setup tab
Selenium.GoToUrl($"http://{CamInfo.IP}", driver);
Selenium.SwitchUser(driver);
Selenium.ClickElementByID("tabSetup", driver);
MainForm.Instance.AddToActionsList($"Successfully connected to {CamInfo.IP} on attempt {attemptCount}", Level.DEBUG);
connected = true;
}
catch (Exception ex)
{
MainForm.Instance.AddToActionsList($"Connection attempt {attemptCount} failed for {CamInfo.IP}: {ex.Message}", Level.DEBUG);
SoakError($"Initial connection failed: {ex.Message}", SoakLogFile, CamInfo.CheckBox);
MainForm.Instance.AddToActionsList($"[{CamInfo.IP}] Initial connection failed:{ex.Message}", Level.ERROR);
@@ -52,20 +57,24 @@ namespace AiQ_GUI
}
catch (Exception ex)
{
MainForm.Instance.AddToActionsList($"Failed to get element IDs from {CamInfo.IP}: {ex.Message}", Level.DEBUG);
SoakError($"Failed to get element IDs: {ex.Message}", SoakLogFile, CamInfo.CheckBox);
return;
}
int lastHour = DateTime.Now.Hour;
int loopCount = 0;
while (!token.IsCancellationRequested)
{
try
{
loopCount++;
string TheString = "Selenium string: " + driver.Manage().Window.Size; // Fails out if Window doesn't exist.
}
catch
{
MainForm.Instance.AddToActionsList($"Driver window lost, cancelling soak for {CamInfo.Serial}", Level.DEBUG);
CTS.Cancel();
continue;
}