Home > Language Reference > Web Functions > ListHTMLItem$

ListHTMLItem$

The ListHTMLElement$ function retrieves the nth item from the specified HTML listbox or combobox.

Usage

Used to test if the items in a listbox/combobox are the desired ones. If the listbox/combobox are not HTML elements, ListHTMLElement$ is not able to retrieve the content but WinTask x64 can still simulate a Copy to clipboard (with the SendKeys("<Ctrl c>",Noactivate) statement) and retrieve the clipboard content using content$=GetClipboard$().

Syntax

var$=ListHTMLItem$(<html_descriptor>, <n>)

Parameters

<html_descriptor>, string, HTML descriptor of the HTML element to click within the current web page specified by the last UsePage. Use Spy tool for generating the <html_descriptor> parameter.

<n>, integer, nth item to retrieve. First item starts at 0.

Return value

var$, string, return value which contains the <n>th item in the listbox or combobox. If the item does not exist, an empty string is returned.

Remarks

ListHTMLItem$ does not include any synchronization; a UsePage must be used before to be sure that the HTML element is ready.

See also

SelectHTMLItem
SelectedHTMLItem$

Examples

StartBrowser("IE", "www.wintask.com/demos")
'Click Form link.
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
a$=ListHTMLItem$("SELECT[NAME= 'subject']", 3)
'Display the 3rd item in the listbox
msgbox(a$)
CloseBrowser()

StartBrowser("FF", "www.wintask.com/demos")
'Click Form link.
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
a$=ListHTMLItem$("SELECT[NAME= 'subject']", 3)
'Display the 3rd element in the listbox
msgbox(a$)
CloseBrowser()

StartBrowser("CH", "www.wintask.com/demos")
'Click Form link.
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
a$=ListHTMLItem$("SELECT[NAME= 'subject']", 3)
'Display the 3rd element in the listbox
msgbox(a$)
CloseBrowser()