Reworked Dailymotion description inputting

pull/2/head
Yuriy 2 years ago
parent 67291b5763
commit 2eb5f5abad

@ -3061,7 +3061,6 @@ if(InStr(CurrentTab, "login")) ; we're logged out
Xpath = //div[@class='overlay__close inside']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100)
; Try clicking the login button, sometimes this will auto log you back in without having to input credentials
xpath = //a[normalize-space()='Log In']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100)
@ -3690,45 +3689,45 @@ if(StrLen(DailyMotionJSDescription) > 3000){
Message = Inputting Video Description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Loop, 15 { ; make a couple attempts to input description
Message = Video Description Input Attempt Number: %A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Loop, 5 { ; make a couple attempts to input description
; TooltipThis("Inputting Video Description")
if(A_index = 5){
Message = Failed to input Description after %A_index% attempts.
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Return
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.Space) ; send an ENTER keystroke to make it register that data has been input and refresh
sleep, 500
; Clear any text from a previous loop
try driver.findElementsByName("description").item[1].clear()
; try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.SPACE) ;;Clicks Item based on the Element Name
; click into element
Xpath = //textarea[@placeholder='Enter a description']
driver.FindElementByXPath(Xpath).click()
; inut description with javascript
js = document.querySelector("textarea[placeholder='Enter a description']").value = "%JSVideoDescription%";
try driver.executeScript(js)
; try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.Space) ; send an ENTER keystroke to make it register that data has been input and refresh
sleep, 1000
sleep, 15000 ; Description dissapears for some reason instantly after inputting sometimes
try Description := driver.findElementsByName("description").item[1].Attribute("value")
if(strlen(Description) 10){
try driver.findElementsByName("description").item[1].SendKeys(driver.Keys.Space) ; send an ENTER keystroke to make it register that data has been input and refresh
Break ; break out of the loop
}
; send a space and then backspace so element registers the input
Xpath = //textarea[@placeholder='Enter a description']
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.SPACE)
if(A_index = 10){
; Clipboard := VideoDescription
Message = Upload Failed (E#7899): Failed to Input video description
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return ; Kick out of the gosub
}
try driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace)
try Description := driver.findElementsByName("description").item[1].Attribute("value")
if(StrLen(Description) > 10){
SaveOrPostProgress(Message:="Description was input successfully",PostType:="Tooltip")
Break ; break out of the loop
js = return document.querySelector("textarea[placeholder='Enter a description']").textContent;
try, InputDescription := driver.executeScript(js)
; if input description is less than 15 chars, try again
if(StrLen(InputDescription)<15){
Continue
}
}
; DevModeMsgBox("done")

Loading…
Cancel
Save