Reworked Subscribstar login check

main
Yuriy 2 years ago
parent dc0b69be8d
commit 05b2a4d862

@ -1707,17 +1707,36 @@ if(InStr(CurrentTabURL, "/login")){
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Xpath = //div[@class='top_bar-login']
Xpath = //div[@class='top_bar-login']
; MsgBox,,Xpath Value,% driver.findelementbyxpath(Xpath).Attribute("value") ;XPath: ID=site-title & span tag
Try LoginStatus := driver.findelementbyxpath(Xpath).Attribute("innerText") ; Grabb innertext
; check for Log In button text
js = return document.querySelector(".top_bar-login.is-button").innerText;
try LoginStatus := driver.executeScript(js)
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")
try driver.Get("https://www.subscribestar.com/login") ; navigate to login page
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
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
sleep, 5000
Xpath = //button[@type='submit']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
}
}
else, {
SaveOrPostProgress(Message:="Login Expired. Please log back in",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
}
Message = Inputting Post
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -3447,7 +3466,6 @@ if(InStr(CurrentTabURL, "/onboarding"))
; Xpath = ///div[@id='textarea-post']
Xpath = //*[contains(text(),'What's new?')]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
DevModeMsgBox("pause")
; Input image
if(ImageAttachmentFilepath != ""){

Loading…
Cancel
Save