Skip to content

Commit 7713220

Browse files
authored
Remove leftover $_WD_HTTPRESULT checks (#446)
1 parent 7310c28 commit 7713220

File tree

1 file changed

+37
-53
lines changed

1 file changed

+37
-53
lines changed

wd_core.au3

Lines changed: 37 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -594,23 +594,18 @@ Func _WD_Window($sSession, $sCommand, $sOption = Default)
594594
EndSwitch
595595

596596
If $iErr = $_WD_ERROR_Success Then
597-
If $_WD_HTTPRESULT = $HTTP_STATUS_OK Then
598-
599-
Switch $sCommand
600-
Case 'close', 'frame', 'fullscreen', 'maximize', 'minimize', 'parent', 'switch'
601-
$sResult = $sResponse
597+
Switch $sCommand
598+
Case 'close', 'frame', 'fullscreen', 'maximize', 'minimize', 'parent', 'switch'
599+
$sResult = $sResponse
602600

603-
Case 'new'
604-
$oJSON = Json_Decode($sResponse)
605-
$sResult = Json_Get($oJSON, "[value][handle]")
601+
Case 'new'
602+
$oJSON = Json_Decode($sResponse)
603+
$sResult = Json_Get($oJSON, "[value][handle]")
606604

607-
Case Else
608-
$oJSON = Json_Decode($sResponse)
609-
$sResult = Json_Get($oJSON, $_WD_JSON_Value)
610-
EndSwitch
611-
Else
612-
$iErr = $_WD_ERROR_Exception
613-
EndIf
605+
Case Else
606+
$oJSON = Json_Decode($sResponse)
607+
$sResult = Json_Get($oJSON, $_WD_JSON_Value)
608+
EndSwitch
614609
EndIf
615610

616611
Return SetError(__WD_Error($sFuncName, $iErr, $sParameters), 0, $sResult)
@@ -670,32 +665,27 @@ Func _WD_FindElement($sSession, $sStrategy, $sSelector, $sStartNodeID = Default,
670665
EndIf
671666

672667
If $iErr = $_WD_ERROR_Success Then
673-
If $_WD_HTTPRESULT = $HTTP_STATUS_OK Then
674-
If $bMultiple Then
668+
If $bMultiple Then
675669

676-
$oJSON = Json_Decode($sResponse)
677-
$oValues = Json_Get($oJSON, $_WD_JSON_Value)
670+
$oJSON = Json_Decode($sResponse)
671+
$oValues = Json_Get($oJSON, $_WD_JSON_Value)
678672

679-
If UBound($oValues) > 0 Then
680-
$sKey = "[" & $_WD_ELEMENT_ID & "]"
673+
If UBound($oValues) > 0 Then
674+
$sKey = "[" & $_WD_ELEMENT_ID & "]"
681675

682-
Dim $aElements[UBound($oValues)]
676+
Dim $aElements[UBound($oValues)]
683677

684-
For $oValue In $oValues
685-
$aElements[$iRow] = Json_Get($oValue, $sKey)
686-
$iRow += 1
687-
Next
688-
Else
689-
$iErr = $_WD_ERROR_NoMatch
690-
EndIf
678+
For $oValue In $oValues
679+
$aElements[$iRow] = Json_Get($oValue, $sKey)
680+
$iRow += 1
681+
Next
691682
Else
692-
$oJSON = Json_Decode($sResponse)
693-
694-
$sResult = Json_Get($oJSON, $_WD_JSON_Element)
683+
$iErr = $_WD_ERROR_NoMatch
695684
EndIf
696-
697685
Else
698-
$iErr = $_WD_ERROR_Exception
686+
$oJSON = Json_Decode($sResponse)
687+
688+
$sResult = Json_Get($oJSON, $_WD_JSON_Element)
699689
EndIf
700690
EndIf
701691

@@ -791,27 +781,21 @@ Func _WD_ElementAction($sSession, $sElement, $sCommand, $sOption = Default)
791781
EndSwitch
792782

793783
If $iErr = $_WD_ERROR_Success Then
794-
Switch $_WD_HTTPRESULT
795-
Case $HTTP_STATUS_OK
796-
Switch $sCommand
797-
Case 'clear', 'click', 'shadow'
798-
$sResult = $sResponse
799-
800-
Case 'value'
801-
If $sOption Then
802-
$sResult = $sResponse
803-
Else
804-
$oJSON = Json_Decode($sResponse)
805-
$sResult = Json_Get($oJSON, $_WD_JSON_Value)
806-
EndIf
807-
808-
Case Else
809-
$oJSON = Json_Decode($sResponse)
810-
$sResult = Json_Get($oJSON, $_WD_JSON_Value)
811-
EndSwitch
784+
Switch $sCommand
785+
Case 'clear', 'click', 'shadow'
786+
$sResult = $sResponse
787+
788+
Case 'value'
789+
If $sOption Then
790+
$sResult = $sResponse
791+
Else
792+
$oJSON = Json_Decode($sResponse)
793+
$sResult = Json_Get($oJSON, $_WD_JSON_Value)
794+
EndIf
812795

813796
Case Else
814-
$iErr = $_WD_ERROR_Exception
797+
$oJSON = Json_Decode($sResponse)
798+
$sResult = Json_Get($oJSON, $_WD_JSON_Value)
815799
EndSwitch
816800
EndIf
817801

0 commit comments

Comments
 (0)