Added extra error logging to try to track down why switching tabs sometimes fails

main
Yuriy 2 years ago
parent 03a93f6570
commit 3b704f009b

@ -1137,6 +1137,11 @@ if(Status){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
} }
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 2000 sleep, 2000
js = document.querySelector("div[class='m9osqain a5q79mjw gy2v8mqq jm1wdb64 k4urcfbm qv66sw1b'] span[class='a8c37x1j ni8dbmo4 stjgntxs l9j0dhe7']").click() js = document.querySelector("div[class='m9osqain a5q79mjw gy2v8mqq jm1wdb64 k4urcfbm qv66sw1b'] span[class='a8c37x1j ni8dbmo4 stjgntxs l9j0dhe7']").click()
@ -1327,6 +1332,12 @@ if(Status){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
} }
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
; Check login status by checking the header of the page for "Feed" text ; Check login status by checking the header of the page for "Feed" text
@ -1705,6 +1716,11 @@ if(InStr(CurrentTabURL, "/login")){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
} }
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -1990,6 +2006,11 @@ if(InStr(CurrentTabURL, "/login")){
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -2205,6 +2226,11 @@ if(InStr(CurrentTabURL, "/login")){
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000 sleep, 1000
try CurrentTabURL := driver.Url try CurrentTabURL := driver.Url
@ -2446,6 +2472,10 @@ if(InStr(CurrentTabURL, "/login")){
if(Status = "Failed") if(Status = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000 sleep, 1000
Message = Checking Login Status Message = Checking Login Status
@ -2638,6 +2668,10 @@ if(InStr(CurrentTabURL, "/login")){
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000 sleep, 1000
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -2745,6 +2779,10 @@ if(InStr(CurrentTabURL, "/login")){
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
; Loop a bunch of times for page to load ; Loop a bunch of times for page to load
SaveOrPostProgress(Message:="Waiting for Page to Load Fully",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Waiting for Page to Load Fully",PostType:="Tooltip,ErrorLoggingTextFile")
loop, 12 { loop, 12 {
@ -3002,6 +3040,10 @@ if(InStr(CurrentTabURL, "/login")){
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Checking for Content from Previous Post Message = Checking for Content from Previous Post
@ -3189,6 +3231,11 @@ if(InStr(CurrentTabURL, "/login")){
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000 sleep, 1000
SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile")
@ -3340,6 +3387,10 @@ if(InStr(CurrentTabURL, "/login")){
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Inputting Post Content Message = Inputting Post Content
@ -3433,6 +3484,11 @@ URLAttempt := NavigateFromBaseURLTo("https://gettr.com/")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -3583,6 +3639,11 @@ URLAttempt := NavigateFromBaseURLTo("https://www.mewe.com/myworld")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
; Click out of try MeWe Premium popup if it appears ; Click out of try MeWe Premium popup if it appears
SaveOrPostProgress(Message:="Checking for Popups and closing them",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Checking for Popups and closing them",PostType:="Tooltip,ErrorLoggingTextFile")
Xpath = //button[normalize-space()='Skip Trial'] Xpath = //button[normalize-space()='Skip Trial']
@ -3714,6 +3775,11 @@ CurrentSite := "Twetch"
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
sleep, 1000 sleep, 1000
Message = Checking Login Status Message = Checking Login Status
@ -3855,6 +3921,10 @@ URLAttempt := NavigateFromBaseURLTo("https://flote.app/")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
SaveOrPostProgress(Message:="Inputting Text",PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:="Inputting Text",PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000 sleep, 1000
@ -3993,6 +4063,10 @@ URLAttempt := NavigateFromBaseURLTo("https://www.thinkspot.com/create/post")
if(URLAttempt = "Failed") if(URLAttempt = "Failed")
Return Return
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -4018,6 +4092,11 @@ if(InStr(CurrentTabURL, "/sign_in")){
} }
Status := CheckCurrentTabForCurrentSite()
if(Status){
Return
}
/* /*

@ -948,6 +948,23 @@ if(TotalTabsFound = 1){
ToolTip, ToolTip,
} }
CheckCurrentTabForCurrentSite(){
try CurrentTabURL := driver.url
if(!InStr(CurrentTabURL, "CurrentSite")){
Message = Chromedriver failed to switch to %CurrentSite%. Please see errorlog for website it got stuck on.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
return "Failed"
}
; msgbox % InStr(CurrentTabURL,CurrentSite)
}
; -------------------------------NavigateFromBaseURLTo------------------------------- ; -------------------------------NavigateFromBaseURLTo-------------------------------
NavigateFromBaseURLTo(URL){ NavigateFromBaseURLTo(URL){
if(!DriverStatus){ ; if not connected to selenium chrome, then re-connect if(!DriverStatus){ ; if not connected to selenium chrome, then re-connect
@ -1031,6 +1048,9 @@ if(TotalTabsFound = 1){
if(InStr(CurrentTabURL, URLBase)){ if(InStr(CurrentTabURL, URLBase)){
Message = CurrentTabURL is %CurrentTabURL% and it contains %URLBase%
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
; msgbox, found it.`n%CurrentTabTitle% = %PageTitle%`n%CurrentTabURL% = %URLBase% ; msgbox, found it.`n%CurrentTabTitle% = %PageTitle%`n%CurrentTabURL% = %URLBase%
TabFoundSuccessfully := 1 TabFoundSuccessfully := 1
; message = %CurrentTabTitle%: %PageTitle% ; message = %CurrentTabTitle%: %PageTitle%
@ -1457,7 +1477,7 @@ SaveDriverURLOFErrorPage(){ ; save the url of the result page. That way if a tab
FindAndActivateTab(TabURL){ FindAndActivateTab(TabURL){
DevModeMsgBox(TabURL) ; DevModeMsgBox(TabURL)
Loop, { Loop, {
if(A_index = 30) if(A_index = 30)
break break

Loading…
Cancel
Save