Reworked Subscribstar login check
This commit is contained in:
@@ -1707,17 +1707,36 @@ 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")
|
||||||
|
|
||||||
|
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
|
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
|
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 != ""){
|
||||||
|
|||||||
Reference in New Issue
Block a user