Вернуть и установить значения связанные с запросом XPath
#Include <FF.au3>
_FFXPath($sQuery[, $sAttribute = "textContent"[, $iReturnType = 2[, $iFilter = 0]]])
Параметры
| $sQuery | Запрос XPath | ||||||||||||||||||||||||||||
| $sAttribute | Опционально: Стандартное значение "textContent" означает установку и получение значения атрибута |
||||||||||||||||||||||||||||
| $iReturnType |
|
||||||||||||||||||||||||||||
| $iFilter |
|
||||||||||||||||||||||||||||
Возвращаемое значение
| Успешное выполнение: | Возвращается:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ошибка: | Значение 0 и установка @ERROR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @ERROR: |
0 ($_FF_ERROR_Success) 3 ($_FF_ERROR_InvalidDataType) 4 ($_FF_ERROR_InvalidValue) 8 ($_FF_ERROR_NoMatch) 9 ($_FF_ERROR_RetValue) 11 ($_FF_ERROR_InvalidExpression) |
Замечания
Применяется FFau3.xpath.
Ссылки
http://www.w3.org/TR/xpath
Связана с функциями
_FFGetValueById, _FFSetValueById, _FFSetValueByName, _FFGetValueById
Пример
#Include <Array.au3>
#Include <FF.au3>
If _FFConnect() Then
_FFTabAdd( "http://ff-au3-example.thorsten-willert.de/")
; counting the number of results from the Xpath query
MsgBox(64, "Number of password fields:", _FFXPath( "//input[@type='password']", "", 10))
; the textContent from the query result
MsgBox(64, "Fieldset-Legend:", _FFXPath( "//form[1]/fieldset/legend"))
; the textContent from option 2
MsgBox(64, "Text from 0ption 5:", _FFXPath( "//option[2]"))
; Method and action of the first form
$vTmp = "Method: " & _FFXPath( "//form[1]/@method") & @crlf
$vTmp &= "Action: " & _FFXPath( "//form[1]/@action")
MsgBox(64, "Form 2", $vTmp)
; array with the textContent of all options
$aArray = _FFXPath("//option","value",7)
_ArrayDisplay($aArray)
; working with the object returned from the query
_FFXPath("//form[1]//input[@type='checkbox' and position()=2]","",9)
MsgBox(64,"", _FFObj("xpath.type") & @crlf & _FFObj("xpath.value"))
_FFObj("xpath.checked=true")
EndIf