Fixed LinkedIn posting to work with website changes
This commit is contained in:
@@ -97,7 +97,7 @@ if(ImageAttachmentFilepath != ""){
|
|||||||
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:="Attaching Image",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
; click attach image button
|
; click attach image button
|
||||||
Xpath = //li-icon[@type='image']//*[name()='svg']
|
Xpath = //button[@aria-label='Add media']
|
||||||
Status := Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
|
Status := Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
|
||||||
if(Status){
|
if(Status){
|
||||||
Message = Failed to click "Attach Image" button with Selenium
|
Message = Failed to click "Attach Image" button with Selenium
|
||||||
@@ -117,7 +117,35 @@ if(ImageAttachmentFilepath != ""){
|
|||||||
; Return
|
; Return
|
||||||
}
|
}
|
||||||
else, {
|
else, {
|
||||||
Status := InputFilePathIntoOpenWindow(ImageAttachmentFilepath)
|
if(WinExist("Open")){
|
||||||
|
Message = Closing "Open" Popup Window so Image can be send directly to input element
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
WinClose, Open
|
||||||
|
}
|
||||||
|
|
||||||
|
Xpath = //input[@id='media-editor-file-selector__file-input']
|
||||||
|
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ImageAttachmentFilepath)
|
||||||
|
if(Status){
|
||||||
|
Message = Post Failed: Failed to Upload Image by sending directly to element.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Xpath = //span[normalize-space()='Next']
|
||||||
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||||
|
if(Status){
|
||||||
|
Message = Post Failed. Image was attached successfully but failed to navigate back to New Post Page
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
SaveDriverURLOFErrorPage()
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; driver.FindElementByXPath(Xpath).SendKeys(ImageAttachmentFilepath)
|
||||||
|
|
||||||
|
/* Status := InputFilePathIntoOpenWindow(ImageAttachmentFilepath)
|
||||||
if(Status)
|
if(Status)
|
||||||
{
|
{
|
||||||
Message = Failed to input filepath into "Open File" window.
|
Message = Failed to input filepath into "Open File" window.
|
||||||
@@ -125,10 +153,11 @@ if(ImageAttachmentFilepath != ""){
|
|||||||
SaveDriverURLOFErrorPage()
|
SaveDriverURLOFErrorPage()
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
; sleep, 10000
|
; sleep, 10000
|
||||||
|
|
||||||
Xpath = //span[normalize-space()='Done'] ; click done button
|
/* Xpath = //span[normalize-space()='Done'] ; click done button
|
||||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)
|
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=10,SleepLength:=1000)
|
||||||
if(Status){
|
if(Status){
|
||||||
Message = Failed to click "Done" button on image upload
|
Message = Failed to click "Done" button on image upload
|
||||||
@@ -139,6 +168,7 @@ if(ImageAttachmentFilepath != ""){
|
|||||||
|
|
||||||
SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:="Waiting 5 seconds for Image to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
sleep, 5000
|
sleep, 5000
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user