diff --git a/Modules/Post-To-Minds.ahk b/Modules/Post-To-Minds.ahk index 287e293..2c65dcc 100644 --- a/Modules/Post-To-Minds.ahk +++ b/Modules/Post-To-Minds.ahk @@ -194,32 +194,34 @@ loop, 3 { } - ; msgbox, ork? - ; click submit button - js = document.querySelector("button[class='m-button m-button--blue m-button--small m-button--dropdown'] span[class='ng-star-inserted']").click(); - try status := driver.executeScript(js) - catch e { - Message = Clicking submit button with JS resulted in status: %status% - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - - Message = Trying to click the Post button using Xpath - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") - - Xpath = (//span[@class='ng-star-inserted'][normalize-space()='Post'])[2] - Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) - if(Status){ - Message = Failed to Submit Post after 2 different attempts + Loop, 5 { + if(A_index = 5){ + Message = Failed to submit after 5 attempts. SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveDriverURLOFErrorPage() Return + } + + js = document.querySelector("button[class='m-button m-button--blue m-button--small m-button--dropdown'] span[class='ng-star-inserted']").click(); + try status := driver.executeScript(js) + + sleep, 500 + ; check if Post button still exists + js = return document.querySelector("m-composer__base[ismodal='true'] m-button[data-ref='post-button'] div").innerText + try, Status := driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons. + + if(!Status){ + ; msgbox, successfully submitted after %A_index% attempts + break } + + sleep, 1000 } - SaveOrPostProgress(Message:="Waiting 5 seconds to confirm post got submitted",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") sleep, 5000