WebElementAllowsFocus

Top  Previous  Next

×V4.3Ø

S

A

W

WS

ü

Syntax -

If WebElementAllowsFocus <Element Identifier> [<Timeout>] ...

       Where:

               <Element Identifier> is a valid web element identifier as described in Identifying an Element.

               <Timeout> is a integer or a variable that contains an integer.

 

Description:

This comparison operator is used to determine if the element defined by <Element Identifier> is visible and enabled.  Checking to see if a web element allows focus is useful in determining if the script will be able to control that element.  If the element is hidden or disabled, the If WebElementExists test will return true, but the script will encounter an error when trying to interact with that element.  In instances where the element may be hidden or disabled, it is best to check using WebElementAllowsFocus before proceeding.  This method of scripting will prevent unhandled errors..

The optional <timeout> parameter allows the user to define a delay (in milliseconds) that the script will wait if the element is not  immediately visible and enabled.  If the element becomes visible and enabled before the end  of the timeout, the script will proceed.  If the element is still not visible and enabled after the end of the timeout is reached, then the script will follow the logic defined in the IF statement.  If this parameter is not defined, then EMUE will attempt to put focus on the element for a period of time defined by WebElementTimeout before evaluating the IF statement.  I

 

Soarian SmartUI: Yes

Chrome: Yes

 

Sample 1:

       The following IF statement will determine if the OK button is enabled and visible.

If WebElementAllowsFocus "Browser=Main:sframeInner->wellFrame->tabWell7:Button,Title=btnOK Patient In,INDEX=1" Then

       ClickWebElement "Browser=Main:sframeInner->wellFrame->tabWell7:Button,Title=btnOK Patient In,INDEX=1"

       GoTo CheckForError

Else

       Goto EnableElement

EndIf

 

Sample 2:

       The following COMPLEX IF statement will determine if the OK button is enabled and visible.

If (!WebElementAllowsFocus("Browser=Main:sframeInner->wellFrame->tabWell7:Button,Title=btnOK Patient In,INDEX=1",5000)) Then

       ClickWebElement "Browser=Main:sframeInner->wellFrame->tabWell7:Button,Title=btnOK Patient In,INDEX=1"

       GoTo CheckForError

Else

       Goto EnableElement

EndIf

 

See Also:

Identifying an Element

WaitForWebPageCompletion

WaitForWebElementGoTo

WaitForWebElement

WebElementTimeout

EnableSoarianSmartUI