Home > Language Reference > Web Functions > CheckedHTML

CheckedHTML

The CheckedHTML function retrieves the status of a web form checkbox or radiobutton element.

Usage

Used for testing the status of a checkbox or radio button in web test scripts.

Syntax

ret=CheckedHTML(<html_descriptor>)

Parameter

<html_descriptor>, string, HTML descriptor of the HTML checkbox/radio button. Use Spy tool for finding this HTML descriptor.

Return value

Ret, numeric return code. If the checkbox/radio button is checked, the function returns 1. If it is not checked, the function 0. If the status of the specified HTML element cannot be retrieved for any reason, the return code is -1. You can use ExistHTMLElement function before the CheckedHTML call to ensure that the object exists..

Remarks

CheckedHTML does not include any synchronization ; a UsePage must be used before to be sure that the checkbox is ready.

See also

SelectedHTMLItem$

Examples

StartBrowser("IE","http://www.wintask.com/demos/form.htm")
UsePage("Form")
'Is the Urgent request checkbox checked?
 ret=CheckedHTML("INPUT CHECKBOX[NAME= 'contactsoon']")
 msgbox(ret)
 'Now check the checkbox
 ClickHTMLElement("INPUT CHECKBOX[NAME= 'contactsoon']")
 'And check again its status using CheckedHTML
 ret=CheckedHTML("INPUT CHECKBOX[NAME= 'contactsoon']")
 msgbox(ret)
 CloseBrowser()



StartBrowser("FF","http://www.wintask.com/demos/form.htm")
UsePage("Form")
'Is the Urgent request checkbox checked?
 ret=CheckedHTML("INPUT CHECKBOX[NAME= 'contactsoon']")
 msgbox(ret)
 'Now check the checkbox
 ClickHTMLElement("INPUT CHECKBOX[NAME= 'contactsoon']")
 'And check again its status using CheckedHTML
 ret=CheckedHTML("INPUT CHECKBOX[NAME= 'contactsoon']")
 msgbox(ret)
 CloseBrowser()


StartBrowser("CH","http://www.wintask.com/demos/form.htm")
UsePage("Form")
'Is the Urgent request checkbox checked?
  ret=CheckedHTML("INPUT CHECKBOX[NAME= 'contactsoon']")
  msgbox(ret)
  'Now check the checkbox
  ClickHTMLElement("INPUT CHECKBOX[NAME= 'contactsoon']")
  'And check again its status using CheckedHTML
  ret=CheckedHTML("INPUT CHECKBOX[NAME= 'contactsoon']")
  msgbox(ret)
  CloseBrowser()