Home > Language Reference > Web Functions > EnabledHTMLElement

EnabledHTMLElement

The EnabledHTMLElement function checks if the specified html element is enabled or disabled.

Usage

For advanced users, it allows to test if an HTML element is enabled or disabled.

Syntax

ret=EnabledHTMLElement(<html_descriptor>)

Parameters

<html_descriptor>, string, HTML descriptor of the HTML element to test. Use Spy tool for generating the <html_descriptor> parameter.

Return value

Ret, numeric return code.  If the element is enabled within the current web page, the function returns 1. If the element is disabled, the function returns 0. If there is no previous UsePage or StartBrowser lines, the function returns -1. 

Remarks

EnabledHTMLELement function does not check if the element to test has finished to load. So a UsePage  statement must be executed before using EnabledHTMLElement: the UsePage makes the automatic synchronization and so the line after the UsePage will be executed only when all the elements on the page are loaded

See also

CaptureHTML
CaptureTableHTML
CheckedHTML
ClickHTMLElement
CloseBrowser
CopyLink
CurrentPage$
ExistHTMLElement
ExtractLink
GetFrameSource$
GetHTMLEditText
GetPageSource$
ListHTMLItem$
Navigate
OverHTMLElement
PreviousPage
SavePictureAs
SaveTargetAs
SelectedHTMLItem$
SelectHTMLItem
StartBrowser
UsePage
WriteHTML
WriteHTMLEncrypted
WriteHTMLPaste

Examples

'Check if an HTML element is enable on a demo page using IE

StartBrowser("IE", "http://www.wintask.com/demos/formdisable.htm")

UsePage("Multiple")

ret=EnabledHTMLElement("INPUT BUTTON[VALUE= 'Disable']")

msgbox(ret) 'returns 0

ret=EnabledHTMLElement("INPUT BUTTON[VALUE= 'Enable']")

msgbox(ret) 'returns 1

'Check if an HTML element is enable on a demo page using Firefox

StartBrowser("FF", "http://www.wintask.com/demos/formdisable.htm")

UsePage("Multiple")

ret=EnabledHTMLElement("INPUT BUTTON[VALUE= 'Disable']")

msgbox(ret) 'returns 0

ret=EnabledHTMLElement("INPUT BUTTON[VALUE= 'Enable']")

msgbox(ret) 'returns 1

'Check if an HTML element is enable on a demo page using Chrome

StartBrowser("CH", "http://www.wintask.com/demos/formdisable.htm")

UsePage("Multiple")

ret=EnabledHTMLElement("INPUT BUTTON[VALUE= 'Disable']")

msgbox(ret) 'returns 0

ret=EnabledHTMLElement("INPUT BUTTON[VALUE= 'Enable']")

msgbox(ret) 'returns 1