Reworked Subscribstar login check

main
Yuriy 2 years ago
parent dc0b69be8d
commit 05b2a4d862

@ -1707,18 +1707,37 @@ if(InStr(CurrentTabURL, "/login")){
Message = Checking Login Status Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Xpath = //div[@class='top_bar-login']
Xpath = //div[@class='top_bar-login'] ; check for Log In button text
; MsgBox,,Xpath Value,% driver.findelementbyxpath(Xpath).Attribute("value") ;XPath: ID=site-title & span tag js = return document.querySelector(".top_bar-login.is-button").innerText;
Try LoginStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext try LoginStatus := driver.executeScript(js)
if(InStr(LoginStatus, "Log In")){ ; need to log in if(InStr(LoginStatus, "Log In")){ ; need to log in
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) SaveOrPostProgress(Message:="Navigating to login page",PostType:="Tooltip,ErrorLoggingTextFile")
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
sleep, 5000 try driver.Get("https://www.subscribestar.com/login") ; navigate to login page
Xpath = //button[@type='submit'] try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(AutoLogin){
; Check if email box contains text inputted by chrome
js = return document.querySelector("input[placeholder='your email']").value;
status := driver.executeScript(js)
if(StrLen(Status) > 0){ ; click enter on the email input field
Xpath = //input[@placeholder='your email']
driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.ENTER)
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
}
}
else, {
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
} }
Message = Inputting Post Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -3447,7 +3466,6 @@ if(InStr(CurrentTabURL, "/onboarding"))
; Xpath = ///div[@id='textarea-post'] ; Xpath = ///div[@id='textarea-post']
Xpath = //*[contains(text(),'What's new?')] Xpath = //*[contains(text(),'What's new?')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
DevModeMsgBox("pause")
; Input image ; Input image
if(ImageAttachmentFilepath != ""){ if(ImageAttachmentFilepath != ""){

Loading…
Cancel
Save