Skip to content

Commit 8065364

Browse files
authored
_WD_GetTable - support for $sStrategy (#501)
1 parent 02cae2b commit 8065364

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

wd_helper.au3

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,24 +2879,26 @@ EndFunc ;==>_WD_DispatchEvent
28792879
; #FUNCTION# ====================================================================================================================
28802880
; Name ..........: _WD_GetTable
28812881
; Description ...: Return all elements of a table.
2882-
; Syntax ........: _WD_GetTable($sSession, $sBaseElement[, $sRowsSelector = Default[, $sColsSelector = Default]])
2882+
; Syntax ........: _WD_GetTable($sSession, $sStrategy, $sSelector[, $sRowsSelector = Default[, $sColsSelector = Default]])
28832883
; Parameters ....: $sSession - Session ID from _WD_CreateSession
2884-
; $sBaseElement - XPath of the table to return
2884+
; $sStrategy - Locator strategy. See defined constant $_WD_LOCATOR_* for allowed values
2885+
; $sSelector - Indicates how the WebDriver should traverse through the HTML DOM to locate the desired <table> element.
28852886
; $sRowsSelector - [optional] Rows CSS selector. Default is "tr".
28862887
; $sColsSelector - [optional] Columns CSS selector. Default is "td, th".
28872888
; Return values .: Success - 2D array.
28882889
; Failure - "" (empty string) and sets @error to one of the following values:
28892890
; - $_WD_ERROR_Exception
28902891
; - $_WD_ERROR_NoMatch
28912892
; Author ........: danylarson
2892-
; Modified ......: water, danp2
2893+
; Modified ......: water, danp2, mLipok
28932894
; Remarks .......:
28942895
; Related .......: _WD_FindElement, _WD_ElementAction, _WD_LastHTTPResult
28952896
; Link ..........: https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-01182020/page/18/?tab=comments#comment-1415164
28962897
; Example .......: No
28972898
; ===============================================================================================================================
2898-
Func _WD_GetTable($sSession, $sBaseElement, $sRowsSelector = Default, $sColsSelector = Default)
2899+
Func _WD_GetTable($sSession, $sStrategy, $sSelector, $sRowsSelector = Default, $sColsSelector = Default)
28992900
Local Const $sFuncName = "_WD_GetTable"
2901+
Local Const $sParameters = 'Parameters: Strategy=' & $sStrategy & ' Selector=' & $sSelector & ' RowsSelector=' & $sRowsSelector & ' ColsSelector=' & $sColsSelector
29002902
Local $sElement, $aTable = ''
29012903
$_WD_HTTPRESULT = 0
29022904
$_WD_HTTPRESPONSE = ''
@@ -2905,7 +2907,7 @@ Func _WD_GetTable($sSession, $sBaseElement, $sRowsSelector = Default, $sColsSele
29052907
If $sColsSelector = Default Then $sColsSelector = "td, th"
29062908

29072909
; Get the table element
2908-
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sBaseElement)
2910+
$sElement = _WD_FindElement($sSession, $sStrategy, $sSelector)
29092911
Local $iErr = @error
29102912

29112913
If $iErr = $_WD_ERROR_Success Then
@@ -2924,7 +2926,7 @@ Func _WD_GetTable($sSession, $sBaseElement, $sRowsSelector = Default, $sColsSele
29242926
EndIf
29252927
EndIf
29262928

2927-
Return SetError(__WD_Error($sFuncName, $iErr), 0, $aTable)
2929+
Return SetError(__WD_Error($sFuncName, $iErr, $sParameters), 0, $aTable)
29282930
EndFunc ;==>_WD_GetTable
29292931

29302932
; #FUNCTION# ====================================================================================================================

0 commit comments

Comments
 (0)