expanded error checking functions
This commit is contained in:
@@ -2455,7 +2455,7 @@ if(Status){
|
||||
; -------------------------------Locals-------------------------------
|
||||
PostToLocals:
|
||||
CurrentSite := "Locals"
|
||||
|
||||
; DevModeMsgBox("clik ok to continue")
|
||||
; @todo: Add auto-login to locals
|
||||
SaveOrPostProgress(Message:="Navigating to Post Creation Page",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
|
||||
@@ -951,7 +951,7 @@ if(TotalTabsFound = 1){
|
||||
CheckCurrentTabForCurrentSite(){
|
||||
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.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
return "Failed"
|
||||
@@ -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%
|
||||
}
|
||||
|
||||
; Driver.Timeout := 1000
|
||||
Driver := ComObjCreate("Selenium.ChromeDriver")
|
||||
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()
|
||||
catch e {
|
||||
|
||||
ShowSeleniumErrorMsgbox()
|
||||
}
|
||||
|
||||
} ; end of catch
|
||||
|
||||
; Save current chrome version to ini file
|
||||
return Driver
|
||||
}
|
||||
; -------------------------------/SChrome_Get-------------------------------
|
||||
@@ -1172,6 +1176,24 @@ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){
|
||||
Chromeversion := RunCMD(GetChromeVersionCommand)
|
||||
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
|
||||
; Msgbox % "Chromeversion: " Chromeversion
|
||||
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")
|
||||
|
||||
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, "")
|
||||
|
||||
IfMsgBox Yes, {
|
||||
@@ -1189,18 +1211,13 @@ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){
|
||||
Reload
|
||||
} Else IfMsgBox No, {
|
||||
run, https://chromedriver.chromium.org/downloads
|
||||
run, "%A_ScriptFullPath%" "LastPost"
|
||||
ExitApp
|
||||
; open chromedriver site
|
||||
} Else IfMsgBox Cancel, {
|
||||
URL = https://freedomainplaylists.com/wp-content/FreedomainScripts/Update`%20Selenium`%20ChromeDriver.pdf
|
||||
Filepath = %A_ScriptDir%\Lib\Update Selenium ChromeDriver.pdf
|
||||
if(!FileExist(Filepath)){
|
||||
UrlDownloadToFile, %URL%, %Filepath%
|
||||
|
||||
run, %Filepath%
|
||||
}
|
||||
run, "https://git.zinchuk.xyz/yuriy/Freedomain-Social-Media-Poster#installation"
|
||||
run, "%A_ScriptFullPath%" "LastPost"
|
||||
ExitApp
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user