diff --git a/Lib/SharedFunctions.ahk b/Lib/SharedFunctions.ahk index b2e6f9f..a9d8b54 100644 --- a/Lib/SharedFunctions.ahk +++ b/Lib/SharedFunctions.ahk @@ -37,8 +37,8 @@ CheckForUpdates(GitReleasesAPIURL){ UpdateVersionNumber := parsed.1.name - Message = UpdateVersionNumber: %UpdateVersionNumber% - DevModeMsgBox(Message) + ; Message = UpdateVersionNumber: %UpdateVersionNumber% + ; DevModeMsgBox(Message) if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){ @@ -783,6 +783,8 @@ SeleniumConnectToActiveTab(IP_Port := "127.0.0.1:9222"){ Driver.SetCapability("debuggerAddress", IP_Port) try Driver.Start() catch e { + Message = Failed to Connect to Chrome. Showing Error Msgbox + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") ShowSeleniumErrorMsgbox() ; msgbox, failed to connect to Chrome for some reason. ; Message = Failed to Connect to Chrome for some reason. @@ -843,7 +845,7 @@ CreateArrayOfChromeTabs() { ; exit after looping through 1 tab, if only 1 tab found in count if(TotalTabsFound = 1 AND A_index > TotalTabsFound){ Message = Exiting Early after 1 loop - DevModeMsgBox(message) + ; DevModeMsgBox(message) break } @@ -1056,8 +1058,13 @@ NavigateFromBaseURLTo(URL,PageTitle := "TodoDeleteme"){ status := ActivateChromeTab(URLBase) - message = ActivateChromeTab Status: %status% - DevModeMsgBox(message) + if(Status = "Failed"){ + try currentURL := driver.url + Message = Failed to switch active tab to %URLBase%. Current tab is: %currentURL% + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + } + ; message = ActivateChromeTab Status: %status% + ; DevModeMsgBox(message) if(!NewTabCreated){ ; if re-using a tab then we want to re-navigate to URL because it might be the wrong page @@ -1093,8 +1100,25 @@ NavigateFromBaseURLTo(URL,PageTitle := "TodoDeleteme"){ } +CheckForAlerts(){ + status := 1 + try driver.SwitchToAlert() + catch e { + status := 0 + return 0 + } + + if(status){ + ; msgbox, alert found + Message = Page Alert Found. Dismissing. + SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") + try driver.switchToalert().dismiss() + return "AlertFound" + } +} + ; End of Function ; -------------------------------/NavigateFromBaseURL-------------------------------