@ -5,8 +5,6 @@
ShowSeleniumErrorMsgbox(){
ShowSeleniumErrorMsgbox(){
; Clipboard := ChromeVersion
; Msgbox % "Chromeversion: " Chromeversion
IniRead, PreviousWorkingChromeVersion, Settings.ini, Misc, ChromeVersion, %A_Space%
IniRead, PreviousWorkingChromeVersion, Settings.ini, Misc, ChromeVersion, %A_Space%
; IniWrite, %ChromeVersion%, Settings.ini, Misc, ChromeVersion
; IniWrite, %ChromeVersion%, Settings.ini, Misc, ChromeVersion
; msgbox, failed to connect to Chrome for some reason.
; msgbox, failed to connect to Chrome for some reason.
@ -14,27 +12,23 @@ ShowSeleniumErrorMsgbox(){
; 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 the instructions website for updating Chromedriver.`n`nPossibly Helpful Info:`nCurrent Chrome Version: %Chromeversion%Chrome Version of Last Successfull Upload: %PreviousWorkingChromeVersion%
MsgBox 0x40043, Error, Failed to Connect to Chrome. `nPossible Causes for this:`n1)One of your tabs is stuck loading/refreshing. (Try closing all tabs) `n2)Chrome has a dialogue box open `n3) 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 the instructions website for updating Chromedriver.`n`nPossibly Helpful Info:`nCurrent Chrome Version: %Chromeversion%Chrome Version of Last Successfull Upload: %PreviousWorkingChromeVersion%
OnMessage(0x44, "")
OnMessage(0x44, "")
IfMsgBox Yes, {
IfMsgBox Yes, {
; Reload script
; Reload script
Reload
Reload
} Else IfMsgBox No, {
}
run, https://chromedriver.chromium.org/downloads
Else IfMsgBox No, {
ExitApp
run, https://chromedriver.chromium.org/downloads
; open chromedriver site
ExitApp
} Else IfMsgBox Cancel, {
; open chromedriver site
URL = https://git.freedomainplaylists.com/yuriy/Freedomain-Social-Media-Poster#installation
} Else IfMsgBox Cancel, {
run, %url%
URL = https://git.freedomainplaylists.com/yuriy/Freedomain-Social-Media-Poster#installation
}
run, %url%
ExitApp
}
}
ExitApp
/*
}
*/
; -------------------------------Tab Navigation & Activation-------------------------------
; -------------------------------Tab Navigation & Activation-------------------------------
@ -183,12 +177,12 @@ CheckCurrentTabForCurrentSite(){
if(!InStr(CurrentTabURL, CurrentSite)){
if(!InStr(CurrentTabURL, CurrentSite)){
Message = Chromedriver failed to switch to %CurrentSite%. Current Tab URL: %CurrentTabURL%
Message = Chromedriver failed to switch to %CurrentSite%. Current Tab URL: %CurrentTabURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging ")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
return "Failed"
return "Failed"
}
}
else, {
else, {
Message = CheckCurrentTabForCurrentSite() passed successfully
Message = CheckCurrentTabForCurrentSite() passed successfully
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging ")
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
}
}
}
}
/*
/*
@ -394,12 +388,12 @@ ActivateChromeTab(URL){
if(A_index < 3){
if(A_index < 3){
if(CurrentTabURL = StartingTabURL){
if(CurrentTabURL = StartingTabURL){
Message = Current Tab URL is THE SAME as Starting URL after %A_index% tab switches`nStuck on this tab?
Message = Current Tab URL is THE SAME as Starting URL after %A_index% tab switches`nStuck on this tab?
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging ")
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
CheckForAlerts()
CheckForAlerts()
}
}
else, {
else, {
Message = Current Tab URL is DIFFERENT from starting URL after %A_index% tab switches
Message = Current Tab URL is DIFFERENT from starting URL after %A_index% tab switches
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging ")
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
}
}
if(LastActiveTab = CurrentTabURL){
if(LastActiveTab = CurrentTabURL){
@ -429,7 +423,7 @@ ActivateChromeTab(URL){
; / loop through tabs
; / loop through tabs
}
}
Message = ActivateChromeTab function failed to activate tab for %urlBase% after looping through %NumberOfTabActivationLoops% tabs
Message = ActivateChromeTab function failed to activate tab for %urlBase% after looping through %NumberOfTabActivationLoops% tabs
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging ")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
return "Failed"
return "Failed"
}
}
@ -438,7 +432,7 @@ ActivateChromeTab(URL){
CheckForAlerts(){
CheckForAlerts(){
Message = Checking for Any Obstructing Alerts in Chrome
Message = Checking for Any Obstructing Alerts in Chrome
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging ")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
status := 1
status := 1
try driver.SwitchToAlert()
try driver.SwitchToAlert()
@ -450,7 +444,7 @@ CheckForAlerts(){
if(status){
if(status){
; msgbox, alert found
; msgbox, alert found
; Message = Page Alert Found. Dismissing.
; Message = Page Alert Found. Dismissing.
Message = Page Alert Found. Accepting.
Message = Page Alert Found. Accepting so page gets refreshed .
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
try driver.switchToalert().accept()
try driver.switchToalert().accept()
; try driver.switchToalert().dismiss()
; try driver.switchToalert().dismiss()
@ -773,6 +767,29 @@ Selenium_LoopToClearXpath(Xpath,NumOfLoops:=1,SleepLength:=1000){
}
}
}
}
Selenium_TypeTextIntoElement(Text, Xpath){
StrLengthOfPost := StrLen(Text)
Loop % StrLengthOfPost{
Current_Char := SubStr(Text, A_index, 1)
; Msgbox % "Current_Char: " Current_Char
; driver.FindElementByXPath(Xpath).SendKeys(VAR)
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100,StringTextContent:=Current_Char)
if(Status){
Message = Failed to Input Text
Return Message
}
}
}
SaveDriverURLOFErrorPage(){ ; save the url of the result page. That way if a tab is not found for a site, we can open up a tab from this tab instead of middle of nowhere. That way we can keep the tabs together
SaveDriverURLOFErrorPage(){ ; save the url of the result page. That way if a tab is not found for a site, we can open up a tab from this tab instead of middle of nowhere. That way we can keep the tabs together
try URLOfLastErrorPage := driver.URL
try URLOfLastErrorPage := driver.URL
}
}