@@ -2400,7 +2400,7 @@ EndFunc ;==>_WD_SetElementValue
2400
2400
; #FUNCTION# ====================================================================================================================
2401
2401
; Name ..........: _WD_ElementActionEx
2402
2402
; Description ...: Perform advanced action on designated element.
2403
- ; Syntax ........: _WD_ElementActionEx($sSession, $sElement, $sCommand[, $iXOffset = Default[, $iYOffset = Default[, $iButton = Default[, $iHoldDelay = Default[, $sModifier = Default]]]]])
2403
+ ; Syntax ........: _WD_ElementActionEx($sSession, $sElement, $sCommand[, $iXOffset = Default[, $iYOffset = Default[, $iButton = Default[, $iHoldDelay = Default[, $sModifier = Default[, $bScrollView = Default] ]]]]])
2404
2404
; Parameters ....: $sSession - Session ID from _WD_CreateSession
2405
2405
; $sElement - Element ID from _WD_FindElement
2406
2406
; $sCommand - one of the following actions:
@@ -2416,11 +2416,12 @@ EndFunc ;==>_WD_SetElementValue
2416
2416
; |RIGHTCLICK - Do a rightclick on the selected element
2417
2417
; |SHOW - Change the element's style to 'display: normal' to unhide/show the element
2418
2418
; |UNCHECK - Unchecks a checkbox input element
2419
- ; $iXOffset - [optional] X Offset. Default is 0
2420
- ; $iYOffset - [optional] Y Offset. Default is 0
2421
- ; $iButton - [optional] Mouse button. Default is $_WD_BUTTON_Left
2422
- ; $iHoldDelay - [optional] Hold time in ms. Default is 1000
2423
- ; $sModifier - [optional] Modifier key. Default is "\uE008" (shift key)
2419
+ ; $iXOffset - [optional] X Offset. Default is 0
2420
+ ; $iYOffset - [optional] Y Offset. Default is 0
2421
+ ; $iButton - [optional] Mouse button. Default is $_WD_BUTTON_Left
2422
+ ; $iHoldDelay - [optional] Hold time in ms. Default is 1000
2423
+ ; $sModifier - [optional] Modifier key. Default is "\uE008" (shift key)
2424
+ ; $bScrollView - [optional] Forcibly scroll element into view? Default is True
2424
2425
; Return values .: Success - Return value from web driver (could be an empty string)
2425
2426
; Failure - "" (empty string) and sets @error to one of the following values:
2426
2427
; - $_WD_ERROR_Exception
@@ -2433,9 +2434,9 @@ EndFunc ;==>_WD_SetElementValue
2433
2434
; Link ..........:
2434
2435
; Example .......: No
2435
2436
; ===============================================================================================================================
2436
- Func _WD_ElementActionEx($sSession , $sElement , $sCommand , $iXOffset = Default , $iYOffset = Default , $iButton = Default , $iHoldDelay = Default , $sModifier = Default )
2437
+ Func _WD_ElementActionEx($sSession , $sElement , $sCommand , $iXOffset = Default , $iYOffset = Default , $iButton = Default , $iHoldDelay = Default , $sModifier = Default , $bScrollView = Default )
2437
2438
Local Const $sFuncName = " _WD_ElementActionEx"
2438
- Local Const $sParameters = ' Parameters: Element=' & $sElement & ' Command=' & $sCommand & ' XOffset=' & $iXOffset & ' YOffset=' & $iYOffset & ' Button=' & $iButton & ' HoldDelay=' & $iHoldDelay & ' Modifier=' & $sModifier
2439
+ Local Const $sParameters = ' Parameters: Element=' & $sElement & ' Command=' & $sCommand & ' XOffset=' & $iXOffset & ' YOffset=' & $iYOffset & ' Button=' & $iButton & ' HoldDelay=' & $iHoldDelay & ' Modifier=' & $sModifier & ' ScrollView= ' & $bScrollView
2439
2440
Local $sAction , $sJavascript , $iErr , $sResult , $iActionType = 1
2440
2441
$_WD_HTTPRESULT = 0
2441
2442
$_WD_HTTPRESPONSE = ' '
@@ -2445,6 +2446,7 @@ Func _WD_ElementActionEx($sSession, $sElement, $sCommand, $iXOffset = Default, $
2445
2446
If $iButton = Default Then $iButton = $_WD_BUTTON_Left
2446
2447
If $iHoldDelay = Default Then $iHoldDelay = 1000
2447
2448
If $sModifier = Default Then $sModifier = " \uE008" ; shift
2449
+ If $bScrollView = Default Then $bScrollView = True
2448
2450
2449
2451
If Not IsInt ($iXOffset ) Then
2450
2452
Return SetError (__WD_Error($sFuncName , $_WD_ERROR_InvalidDataType , " (int) $iXOffset: " & $iXOffset ), 0 , " " )
@@ -2565,6 +2567,11 @@ Func _WD_ElementActionEx($sSession, $sElement, $sCommand, $iXOffset = Default, $
2565
2567
' }' , @TAB , ' ' )
2566
2568
#EndRegion - JSON builder
2567
2569
2570
+ If $bScrollView Then
2571
+ _WD_ExecuteScript($sSession , " arguments[0].scrollIntoView(false);" , __WD_JsonElement($sElement ))
2572
+ Sleep (500 )
2573
+ EndIf
2574
+
2568
2575
Switch $iActionType
2569
2576
Case 1
2570
2577
$sAction = StringFormat ($sActionTemplate , $sPreAction , $iXOffset , $iYOffset , $sElement , $sElement , $sPostHoverAction , $sPostAction )
0 commit comments