@@ -393,8 +393,8 @@ Func _WD_Action($sSession, $sCommand, $sOption = '')
393
393
Local Const $sFuncName = " _WD_Action"
394
394
Local $sResponse , $sResult = " " , $iErr , $sJSON , $sURL
395
395
396
- $sURL = $_WD_BASE_URL & " :" & $_WD_PORT & " /session/" & $sSession & " /" & $sCommand
397
396
$sCommand = StringLower ($sCommand )
397
+ $sURL = $_WD_BASE_URL & " :" & $_WD_PORT & " /session/" & $sSession & " /" & $sCommand
398
398
399
399
Switch $sCommand
400
400
Case ' back' , ' forward' , ' refresh'
@@ -607,14 +607,19 @@ Func _WD_FindElement($sSession, $sStrategy, $sSelector, $sStartElement = "", $lM
607
607
608
608
$oJson = Json_Decode($sResponse )
609
609
$oValues = Json_Get($oJson , ' [value]' )
610
- $sKey = " [" & Json_ObjGetKeys($oValues [0 ])[0 ] & " ]"
611
610
612
- Dim $aElements [UBound ($oValues )]
611
+ If UBound ($oValues ) > 0 Then
612
+ $sKey = " [" & Json_ObjGetKeys($oValues [0 ])[0 ] & " ]"
613
+
614
+ Dim $aElements [UBound ($oValues )]
613
615
614
- For $oValue In $oValues
615
- $aElements [$iRow ] = Json_Get($oValue , $sKey )
616
- $iRow += 1
617
- Next
616
+ For $oValue In $oValues
617
+ $aElements [$iRow ] = Json_Get($oValue , $sKey )
618
+ $iRow += 1
619
+ Next
620
+ Else
621
+ $iErr = $_WD_ERROR_NoMatch
622
+ EndIf
618
623
Else
619
624
$oJson = Json_Decode($sResponse )
620
625
$Obj2 = Json_Get($oJson , " [value]" )
0 commit comments