@@ -52,7 +52,8 @@ Global Enum _
52
52
$_WD_OPTION_Visible = 1 , _
53
53
$_WD_OPTION_Enabled = 2 , _
54
54
$_WD_OPTION_Element = 4 , _
55
- $_WD_OPTION_NoMatch = 8
55
+ $_WD_OPTION_NoMatch = 8 , _
56
+ $_WD_OPTION_Hidden = 16
56
57
57
58
Global Enum _
58
59
$_WD_OPTION_Standard , _
@@ -338,7 +339,8 @@ EndFunc ;==>_WD_LinkClickByText
338
339
; |$_WD_OPTION_None (0) = No optional feature processing
339
340
; |$_WD_OPTION_Visible (1) = Confirm element is visible
340
341
; |$_WD_OPTION_Enabled (2) = Confirm element is enabled
341
- ; |$_WD_OPTION_NoMatch (8) = Confirm element not found
342
+ ; |$_WD_OPTION_NoMatch (8) = Confirm element is not found
343
+ ; |$_WD_OPTION_Hidden (16) = Confirm element is not visible
342
344
; Return values .: Success - Element ID returned by web driver.
343
345
; Failure - "" (empty string) and sets @error to one of the following values:
344
346
; - $_WD_ERROR_Exception
@@ -363,12 +365,14 @@ Func _WD_WaitElement($sSession, $sStrategy, $sSelector, $iDelay = Default, $iTim
363
365
If $iTimeout = Default Then $iTimeout = $_WD_DefaultTimeout
364
366
If $iOptions = Default Then $iOptions = $_WD_OPTION_None
365
367
366
- Local $bVisible = BitAND ($iOptions , $_WD_OPTION_Visible )
367
- Local $bEnabled = BitAND ($iOptions , $_WD_OPTION_Enabled )
368
- Local $bCheckNoMatch = BitAND ($iOptions , $_WD_OPTION_NoMatch )
368
+ Local Const $bVisible = BitAND ($iOptions , $_WD_OPTION_Visible )
369
+ Local Const $bEnabled = BitAND ($iOptions , $_WD_OPTION_Enabled )
370
+ Local Const $bNoMatch = BitAND ($iOptions , $_WD_OPTION_NoMatch )
371
+ Local Const $bHidden = BitAND ($iOptions , $_WD_OPTION_Hidden )
369
372
370
- ; Other options aren't valid if No Match option is supplied
371
- If $bCheckNoMatch And $iOptions <> $_WD_OPTION_NoMatch Then
373
+ ; Other options aren't valid if No Match or Hidden option is supplied
374
+ If ($bNoMatch And $iOptions <> $_WD_OPTION_NoMatch ) Or _
375
+ ($bHidden And $iOptions <> $_WD_OPTION_Hidden ) Then
372
376
$iErr = $_WD_ERROR_InvalidArgue
373
377
Else
374
378
__WD_Sleep($iDelay )
@@ -391,16 +395,16 @@ Func _WD_WaitElement($sSession, $sStrategy, $sSelector, $iDelay = Default, $iTim
391
395
; Exit loop if unexpected error occurs
392
396
ExitLoop
393
397
394
- ElseIf $iErr = $_WD_ERROR_NoMatch And $bCheckNoMatch Then
398
+ ElseIf $iErr = $_WD_ERROR_NoMatch And $bNoMatch Then
395
399
; if element wasn't found and "no match" option is active
396
400
; exit loop indicating success
397
401
$iErr = $_WD_ERROR_Success
398
402
ExitLoop
399
403
400
- ElseIf $iErr = $_WD_ERROR_Success And Not $bCheckNoMatch Then
404
+ ElseIf $iErr = $_WD_ERROR_Success And Not $bNoMatch Then
401
405
; if element was found and "no match" option isn't active
402
- ; check $bVisible and $bEnabled options
403
- If $bVisible Then
406
+ ; check other options
407
+ If $bVisible Or $bHidden Then
404
408
$bIsVisible = _WD_ElementAction($sSession , $sElement , ' displayed' )
405
409
406
410
If @error Then
@@ -417,11 +421,16 @@ Func _WD_WaitElement($sSession, $sStrategy, $sSelector, $iDelay = Default, $iTim
417
421
EndIf
418
422
EndIf
419
423
420
- If $bIsVisible And $bIsEnabled Then
424
+ Select
425
+ Case $bHidden
426
+ If Not $bIsVisible Then ExitLoop
427
+
428
+ Case $bIsVisible And $bIsEnabled
421
429
ExitLoop
422
- Else
430
+
431
+ Case Else
423
432
$sElement = ' '
424
- EndIf
433
+ EndSelect
425
434
EndIf
426
435
427
436
If (TimerDiff ($hWaitTimer ) > $iTimeout ) Then
0 commit comments