small code refactoring and new function to check for any active alerts in current chrome tab
This commit is contained in:
@@ -37,8 +37,8 @@ CheckForUpdates(GitReleasesAPIURL){
|
|||||||
|
|
||||||
UpdateVersionNumber := parsed.1.name
|
UpdateVersionNumber := parsed.1.name
|
||||||
|
|
||||||
Message = UpdateVersionNumber: %UpdateVersionNumber%
|
; Message = UpdateVersionNumber: %UpdateVersionNumber%
|
||||||
DevModeMsgBox(Message)
|
; DevModeMsgBox(Message)
|
||||||
|
|
||||||
|
|
||||||
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
||||||
@@ -783,6 +783,8 @@ SeleniumConnectToActiveTab(IP_Port := "127.0.0.1:9222"){
|
|||||||
Driver.SetCapability("debuggerAddress", IP_Port)
|
Driver.SetCapability("debuggerAddress", IP_Port)
|
||||||
try Driver.Start()
|
try Driver.Start()
|
||||||
catch e {
|
catch e {
|
||||||
|
Message = Failed to Connect to Chrome. Showing Error Msgbox
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
ShowSeleniumErrorMsgbox()
|
ShowSeleniumErrorMsgbox()
|
||||||
; msgbox, failed to connect to Chrome for some reason.
|
; msgbox, failed to connect to Chrome for some reason.
|
||||||
; Message = 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
|
; exit after looping through 1 tab, if only 1 tab found in count
|
||||||
if(TotalTabsFound = 1 AND A_index > TotalTabsFound){
|
if(TotalTabsFound = 1 AND A_index > TotalTabsFound){
|
||||||
Message = Exiting Early after 1 loop
|
Message = Exiting Early after 1 loop
|
||||||
DevModeMsgBox(message)
|
; DevModeMsgBox(message)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1056,8 +1058,13 @@ NavigateFromBaseURLTo(URL,PageTitle := "TodoDeleteme"){
|
|||||||
|
|
||||||
|
|
||||||
status := ActivateChromeTab(URLBase)
|
status := ActivateChromeTab(URLBase)
|
||||||
message = ActivateChromeTab Status: %status%
|
if(Status = "Failed"){
|
||||||
DevModeMsgBox(message)
|
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
|
if(!NewTabCreated){ ; if re-using a tab then we want to re-navigate to URL because it might be the wrong page
|
||||||
|
|
||||||
@@ -1093,7 +1100,24 @@ 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
|
; End of Function
|
||||||
; -------------------------------/NavigateFromBaseURL-------------------------------
|
; -------------------------------/NavigateFromBaseURL-------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user