@@ -611,41 +611,56 @@ EndFunc ;==>_WD_GetMouseElement
611
611
Func _WD_GetElementFromPoint($sSession , $iX , $iY )
612
612
Local Const $sFuncName = " _WD_GetElementFromPoint"
613
613
Local Const $sParameters = ' Parameters: X=' & $iX & ' Y=' & $iY
614
- Local $sElement , $sTagName , $sParams , $aCoords , $iFrame = 0 , $oERect
614
+ Local $sResponse , $oJSON , $sElement = " "
615
+ Local $sTagName , $sParams , $aCoords , $iFrame = 0 , $oERect
615
616
Local $sScript1 = " return document.elementFromPoint(arguments[0], arguments[1]);"
616
617
Local $sScript2 = " return new Array(window.pageXOffset, window.pageYOffset);"
617
- Local $iErr = $_WD_ERROR_Success
618
+ Local $iErr = $_WD_ERROR_Success , $sResult , $bIsNull
618
619
619
620
While True
620
621
$sParams = $iX & " , " & $iY
621
- $sElement = _WD_ExecuteScript($sSession , $sScript1 , $sParams , Default , $_WD_JSON_Element )
622
+ $sResponse = _WD_ExecuteScript($sSession , $sScript1 , $sParams )
622
623
If @error Then
623
624
$iErr = $_WD_ERROR_RetValue
624
625
ExitLoop
625
626
EndIf
626
627
627
- $sTagName = _WD_ElementAction($sSession , $sElement , " Name" )
628
- If Not StringInStr (" frame" , $sTagName ) Then ; check <iframe> and <frame> element
629
- ExitLoop
630
- EndIf
628
+ $oJSON = Json_Decode($sResponse )
629
+ $sElement = Json_Get($oJSON , $_WD_JSON_Element )
631
630
632
- $aCoords = _WD_ExecuteScript($sSession , $sScript2 , $_WD_EmptyDict , Default , $_WD_JSON_Value )
633
631
If @error Then
634
- $iErr = $_WD_ERROR_RetValue
632
+ $sResult = Json_Get($oJSON , $_WD_JSON_Value )
633
+ $bIsNull = (IsKeyword ($sResult ) = $KEYWORD_NULL )
634
+
635
+ If Not $bIsNull Then
636
+ $iErr = $_WD_ERROR_RetValue
637
+ EndIf
638
+
635
639
ExitLoop
636
- EndIf
640
+ Else
641
+ $sTagName = _WD_ElementAction($sSession , $sElement , " Name" )
642
+ If Not StringInStr ($sTagName , " frame" ) Then ; check <iframe> and <frame> element
643
+ ExitLoop
644
+ EndIf
645
+
646
+ $aCoords = _WD_ExecuteScript($sSession , $sScript2 , $_WD_EmptyDict , Default , $_WD_JSON_Value )
647
+ If @error Then
648
+ $iErr = $_WD_ERROR_RetValue
649
+ ExitLoop
650
+ EndIf
637
651
638
- $oERect = _WD_ElementAction($sSession , $sElement , ' rect' )
652
+ $oERect = _WD_ElementAction($sSession , $sElement , ' rect' )
639
653
640
- ; changing the coordinates in relation to left top corner of frame
641
- $iX -= ($oERect .Item(' x' ) - Int ($aCoords [0 ]))
642
- $iY -= ($oERect .Item(' y' ) - Int ($aCoords [1 ]))
654
+ ; changing the coordinates in relation to left top corner of frame
655
+ $iX -= ($oERect .Item(' x' ) - Int ($aCoords [0 ]))
656
+ $iY -= ($oERect .Item(' y' ) - Int ($aCoords [1 ]))
643
657
644
- _WD_FrameEnter($sSession , $sElement )
645
- $iFrame = 1
658
+ _WD_FrameEnter($sSession , $sElement )
659
+ $iFrame = 1
660
+ EndIf
646
661
WEnd
647
662
648
- Return SetError (__WD_Error($sFuncName , $iErr , $sParameters ), $iFrame , $sElement )
663
+ Return SetError (__WD_Error($sFuncName , $iErr , $sParameters , $iFrame ), $iFrame , $sElement )
649
664
EndFunc ; ==>_WD_GetElementFromPoint
650
665
651
666
; #FUNCTION# ====================================================================================================================
@@ -1942,7 +1957,7 @@ EndFunc ;==>_WD_GetShadowRoot
1942
1957
Func _WD_SelectFiles($sSession , $sStrategy , $sSelector , $sFilename )
1943
1958
Local Const $sFuncName = " _WD_SelectFiles"
1944
1959
Local Const $sParameters = ' Parameters: Strategy=' & $sStrategy & ' Selector=' & $sSelector & ' Filename=' & $sFilename
1945
- Local $sResult = " 0" , $sSavedEscape
1960
+ Local $sResult = " 0"
1946
1961
Local $sElement = _WD_FindElement($sSession , $sStrategy , $sSelector )
1947
1962
Local $iErr = @error
1948
1963
0 commit comments