@ -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
}
}
}
}