GXtest UI Commands - Control Focus

Official Content
This documentation is valid for:

This command is useful to check if a control is focused on the page.

These commands return true if the control has the focus and false if not. 

IsControlFocused

IsControlFocused_2020929172815_1_png

Goal: To check if a control is focused.

Parameters:

  • ControlName: the name of the control as defined in the KB.

Example of use: 

&driver.IsControlFocused("Name")

IsControlFocused

IsControlFocusedGrid_png

Goal: To check if a control is focused.

Parameters:

  • ControlName: the name of the control as defined in the KB.
  • Row: the row number to locate the control inside a grid

Example of use: 

&driver.IsControlFocused("Name", 3)
&driver.IsControlFocused("FilterComp.Search", 1)

 

Also, they can be executed using different HTML locators (id, name, CSS, XPath or LinkText) as follows:

IsElementFocusedByID

image_202092917302_1_png

Goal: To check if an element it’s focused using its ID.

Parameters:

  • ID: the HTML element ID .

Example of use: 

&driver.IsElementFocusedByID("InvoiceTotal")

IsElementFocusedByName

image_2020929173126_1_png

Goal: To check if an element it’s focused using its 'name' attribute.

Parameters:

  • Name: the value of the NAME attribute of the element. 

Example of use: 

&driver.IsElementFocusedByName("total")

IsElementFocusedByCSS

image_2020929172933_1_png

Goal: To check if an element it’s focused using its CSS selector.

Parameters:

  • CSS: the CSS selector to the element. 

Example of use: 

&driver.IsElementFocusedByCSS("#vVAR1")

IsElementFocusedByXPath

image_2020929173151_1_png

Goal: To check if an element it’s focused using an XPath selector.

Parameters:

  • XPath: the XPath selector to the element. 

Example of use: 

&driver.IsElementFocusedByXPath("//textarea[@id='vVAR1']")

IsElementFocusedByLinkText

image_2020929173051_1_png

Goal: To check if an element it’s focused using a LinkText selector.

Parameters:

  • LinkText: the link’s text of the element. 

Example of use: 

&driver.IsElementFocusedByLinkText("Edit")