expanded error checking functions
This commit is contained in:
@@ -2007,9 +2007,9 @@ if(InStr(CurrentTabURL, "/login")){
|
|||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
Message = Checking Login Status
|
Message = Checking Login Status
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
@@ -2227,9 +2227,9 @@ if(Status){
|
|||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep, 1000
|
sleep, 1000
|
||||||
|
|
||||||
@@ -2455,7 +2455,7 @@ if(Status){
|
|||||||
; -------------------------------Locals-------------------------------
|
; -------------------------------Locals-------------------------------
|
||||||
PostToLocals:
|
PostToLocals:
|
||||||
CurrentSite := "Locals"
|
CurrentSite := "Locals"
|
||||||
|
; DevModeMsgBox("clik ok to continue")
|
||||||
; @todo: Add auto-login to locals
|
; @todo: Add auto-login to locals
|
||||||
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
@@ -2472,10 +2472,10 @@ if(Status){
|
|||||||
if(Status = "Failed")
|
if(Status = "Failed")
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
sleep, 1000
|
sleep, 1000
|
||||||
|
|
||||||
Message = Checking Login Status
|
Message = Checking Login Status
|
||||||
@@ -2668,10 +2668,10 @@ if(Status){
|
|||||||
if(URLAttempt = "Failed")
|
if(URLAttempt = "Failed")
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
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")
|
||||||
@@ -2779,10 +2779,10 @@ if(Status){
|
|||||||
if(URLAttempt = "Failed")
|
if(URLAttempt = "Failed")
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
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 {
|
||||||
@@ -3040,10 +3040,10 @@ if(Status){
|
|||||||
if(URLAttempt = "Failed")
|
if(URLAttempt = "Failed")
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Message = Checking for Content from Previous Post
|
Message = Checking for Content from Previous Post
|
||||||
@@ -3232,9 +3232,9 @@ if(Status){
|
|||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep, 1000
|
sleep, 1000
|
||||||
SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:="Checking Login Status",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
@@ -3387,10 +3387,10 @@ if(Status){
|
|||||||
if(URLAttempt = "Failed")
|
if(URLAttempt = "Failed")
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Message = Inputting Post Content
|
Message = Inputting Post Content
|
||||||
@@ -3775,10 +3775,10 @@ CurrentSite := "Twetch"
|
|||||||
if(URLAttempt = "Failed")
|
if(URLAttempt = "Failed")
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Status := CheckCurrentTabForCurrentSite()
|
Status := CheckCurrentTabForCurrentSite()
|
||||||
if(Status){
|
if(Status){
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep, 1000
|
sleep, 1000
|
||||||
|
|
||||||
|
|||||||
@@ -948,21 +948,21 @@ if(TotalTabsFound = 1){
|
|||||||
ToolTip,
|
ToolTip,
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckCurrentTabForCurrentSite(){
|
CheckCurrentTabForCurrentSite(){
|
||||||
try CurrentTabURL := driver.url
|
try CurrentTabURL := driver.url
|
||||||
|
|
||||||
if(!InStr(CurrentTabURL, "CurrentSite")){
|
if(!InStr(CurrentTabURL, CurrentSite)){
|
||||||
Message = Chromedriver failed to switch to %CurrentSite%. Please see errorlog for website it got stuck on.
|
Message = Chromedriver failed to switch to %CurrentSite%. Please see errorlog for website it got stuck on.
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
return "Failed"
|
return "Failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; msgbox % InStr(CurrentTabURL,CurrentSite)
|
; msgbox % InStr(CurrentTabURL,CurrentSite)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
; -------------------------------NavigateFromBaseURLTo-------------------------------
|
; -------------------------------NavigateFromBaseURLTo-------------------------------
|
||||||
@@ -1153,16 +1153,20 @@ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){
|
|||||||
run, %ChromeFilepath% --remote-debugging-port=%IP_Port_Nr% %URL%
|
run, %ChromeFilepath% --remote-debugging-port=%IP_Port_Nr% %URL%
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; Driver.Timeout := 1000
|
||||||
Driver := ComObjCreate("Selenium.ChromeDriver")
|
Driver := ComObjCreate("Selenium.ChromeDriver")
|
||||||
Driver.SetCapability("debuggerAddress", IP_Port)
|
Driver.SetCapability("debuggerAddress", IP_Port)
|
||||||
|
|
||||||
|
SaveOrPostProgress(Message:="Trying to connect to Chrome.`nIf stuck here check for dialog popups or your ChromeDriver`nClose chrome to break out of program being stuck.",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
|
||||||
|
|
||||||
|
; set selenium timeout to 1 second, instead of default 5 seconds
|
||||||
|
|
||||||
|
|
||||||
try Driver.Start()
|
try Driver.Start()
|
||||||
catch e {
|
catch e {
|
||||||
|
|
||||||
ShowSeleniumErrorMsgbox()
|
ShowSeleniumErrorMsgbox()
|
||||||
|
}
|
||||||
|
|
||||||
} ; end of catch
|
|
||||||
|
|
||||||
; Save current chrome version to ini file
|
|
||||||
return Driver
|
return Driver
|
||||||
}
|
}
|
||||||
; -------------------------------/SChrome_Get-------------------------------
|
; -------------------------------/SChrome_Get-------------------------------
|
||||||
@@ -1172,6 +1176,24 @@ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){
|
|||||||
Chromeversion := RunCMD(GetChromeVersionCommand)
|
Chromeversion := RunCMD(GetChromeVersionCommand)
|
||||||
ChromeVersion := StrReplace(ChromeVersion, "`n", "")
|
ChromeVersion := StrReplace(ChromeVersion, "`n", "")
|
||||||
|
|
||||||
|
Message = Failed to connect to Chrome
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
|
||||||
|
/*
|
||||||
|
; check for alert popup
|
||||||
|
try alertText := driver.SwitchToAlert().Text
|
||||||
|
; DevModeMsgBox(alertText)
|
||||||
|
if(alertText){
|
||||||
|
Message = Alert Popup Text: %alertText%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,ErrorSummaryVar")
|
||||||
|
SaveOrPostProgress(Message:="Chrome stuck on alert popup",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
DevModeMsgBox("alert popup found")
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
; Msgbox % "alertText: " alertText
|
||||||
|
|
||||||
; Clipboard := ChromeVersion
|
; Clipboard := ChromeVersion
|
||||||
; Msgbox % "Chromeversion: " Chromeversion
|
; Msgbox % "Chromeversion: " Chromeversion
|
||||||
IniRead, PreviousWorkingChromeVersion, Settings.ini, Misc, ChromeVersion, %A_Space%
|
IniRead, PreviousWorkingChromeVersion, Settings.ini, Misc, ChromeVersion, %A_Space%
|
||||||
@@ -1181,7 +1203,7 @@ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){
|
|||||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
|
||||||
OnMessage(0x44, "OnMsgBoxChromeDriverFailed")
|
OnMessage(0x44, "OnMsgBoxChromeDriverFailed")
|
||||||
MsgBox 0x40043, Error, Failed to Connect to Chrome. `nMost likely issue is either Chrome has some sort of dialogue box open or ChromeDriver needs to be updated.`n`nClick "Reload" to reload the script to try again`nClick "ChromeDriver" to open up the ChromeDriver download page. `n`nClick "Instructions" to open up .pdf file with instructions for updating chromedriver.exe`n`nPossibly Helpful Info:`nCurrent Chrome Version: %Chromeversion%Chrome Version of Last Successfull Upload: %PreviousWorkingChromeVersion%
|
MsgBox 0x40043, Error, Failed to Connect to Chrome. `nMost likely issue is either Chrome has some sort of dialogue box open or ChromeDriver needs to be updated.`n`nClick "Reload" to reload with your Last Post`nClick "ChromeDriver" to open up the ChromeDriver download page. `n`nClick "Instructions" to open up installation instructions in your default browser.`n`n Information:`nCurrent Chrome Version: %Chromeversion%Chrome Version of Last Successfull Upload: %PreviousWorkingChromeVersion%
|
||||||
OnMessage(0x44, "")
|
OnMessage(0x44, "")
|
||||||
|
|
||||||
IfMsgBox Yes, {
|
IfMsgBox Yes, {
|
||||||
@@ -1189,18 +1211,13 @@ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){
|
|||||||
Reload
|
Reload
|
||||||
} Else IfMsgBox No, {
|
} Else IfMsgBox No, {
|
||||||
run, https://chromedriver.chromium.org/downloads
|
run, https://chromedriver.chromium.org/downloads
|
||||||
|
run, "%A_ScriptFullPath%" "LastPost"
|
||||||
ExitApp
|
ExitApp
|
||||||
; open chromedriver site
|
; open chromedriver site
|
||||||
} Else IfMsgBox Cancel, {
|
} Else IfMsgBox Cancel, {
|
||||||
URL = https://freedomainplaylists.com/wp-content/FreedomainScripts/Update`%20Selenium`%20ChromeDriver.pdf
|
run, "https://git.zinchuk.xyz/yuriy/Freedomain-Social-Media-Poster#installation"
|
||||||
Filepath = %A_ScriptDir%\Lib\Update Selenium ChromeDriver.pdf
|
run, "%A_ScriptFullPath%" "LastPost"
|
||||||
if(!FileExist(Filepath)){
|
|
||||||
UrlDownloadToFile, %URL%, %Filepath%
|
|
||||||
|
|
||||||
run, %Filepath%
|
|
||||||
}
|
|
||||||
ExitApp
|
ExitApp
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user