Name:
Get Matching Xpath Count
Source:
Selenium2Library <test library>
Arguments:
[ xpath ]
Returns number of elements matching `xpath`
If you wish to assert the number of matching elements, use `Xpath Should Match X Times`.
================
${str} Get Matching Xpath Count //table[@class="layout layoutblod"]/tbody/tr
log ${str}
${str1} Get Matching Xpath Count xpath=//table[@class="layout layoutblod"]/tbody/tr[1]/td
log ${str1}
注意:参数是XPATH,所以直接写就行,不要写上XPATH=***,否则会报错:
Unable to locate an element with the xpath expression xpath=//table[@class="layout layoutblod"]/tbody/tr[1]/td because of the following error: [Exception... "The expression cannot be converted to return the specified type." code: "0" nsresult: "0x805b0034 (TypeError)"