|
|
@ -721,21 +721,27 @@ Selenium_LoopToSendValueByName(ElementName,NumOfLoops:=1,SleepLength:=1000,Strin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Selenium_LoopToSendValueToXpath(Xpath,NumOfLoops:=1,SleepLength:=1000,StringTextContent:="",ClearElement:=0){
|
|
|
|
Selenium_LoopToSendValueToXpath(Xpath,NumOfLoops:=1,SleepLength:=1000,StringTextContent:="",ClearElement:=0){
|
|
|
|
; Msgbox % "StringTextContent: " StringTextContent
|
|
|
|
|
|
|
|
; Msgbox % "ClearElement: " ClearElement
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loop, %NumOfLoops% {
|
|
|
|
loop, %NumOfLoops% {
|
|
|
|
; msgbox % ClearElement
|
|
|
|
|
|
|
|
if(ClearElement){
|
|
|
|
if(ClearElement){
|
|
|
|
Loop, 3 { ; have to do it multiple times to make it trigger properly
|
|
|
|
Loop, 3 { ; sometimes have to do it multiple times to make it trigger properly
|
|
|
|
|
|
|
|
Try PreviousValue := driver.findelementbyxpath(Xpath).Attribute("value") ;Xpath Value
|
|
|
|
|
|
|
|
|
|
|
|
try, driver.FindElementByXPath(Xpath).clear()
|
|
|
|
try, driver.FindElementByXPath(Xpath).clear()
|
|
|
|
sleep, 500
|
|
|
|
|
|
|
|
|
|
|
|
Try CurrentValue := driver.findelementbyxpath(Xpath).Attribute("value") ;Xpath Value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(PreviousValue != CurrentValue){
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sleep, 1000
|
|
|
|
|
|
|
|
; msgbox
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try driver.FindElementByXPath(Xpath).sendKeys(StringTextContent) ; Input Text
|
|
|
|
; ToolTip, Loop attempt: %A_index%
|
|
|
|
|
|
|
|
try driver.FindElementByXPath(Xpath).sendKeys(StringTextContent) ; Click on "upload image" button
|
|
|
|
|
|
|
|
catch e {
|
|
|
|
catch e {
|
|
|
|
if(A_index = NumOfLoops){
|
|
|
|
if(A_index = NumOfLoops){
|
|
|
|
Return "Failed"
|
|
|
|
Return "Failed"
|
|
|
@ -803,7 +809,7 @@ Selenium_LoopToClearXpath(Xpath,NumberOfAttemps:=1,SleepLength:=1000){
|
|
|
|
try, InerText := driver.findelementbyxpath(Xpath).Attribute("value")
|
|
|
|
try, InerText := driver.findelementbyxpath(Xpath).Attribute("value")
|
|
|
|
; Msgbox % "InerText: " InerText
|
|
|
|
; Msgbox % "InerText: " InerText
|
|
|
|
if(InerText = "")
|
|
|
|
if(InerText = "")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
if(A_index = NumberOfAttemps){
|
|
|
|
if(A_index = NumberOfAttemps){
|
|
|
|
return "Failed after %NumberOfAttemps"
|
|
|
|
return "Failed after %NumberOfAttemps"
|
|
|
|