GXtest UI Commands - Get Text

Official Content
This documentation is valid for:

Getting the visible text from controls is very useful for several purposes.

Typically is used combined with assertions to let GXtest check for expected conditions. Another common usage is to retrieve web panel data that needs to be used in other test case steps.

GetText

GetText_png

Command used to retrieve the text of a control

Parameters

  • ControlName: name of the control to retrieve the text

Example

&driver.GetText("ControlLabel")

GetText

GetTextGrid_png

Command used to retrieve the text of a control

Parameters

  • ControlName: name of the control to retrieve the text
  • Row: row number inside the grid

Example

&driver.GetText("ControlLabel", 3)

GetTextByID

Goal: To get the text from an HTML element using its ID.

Returns: The text of the selected element.

Parameters:

  • ID: the HTML element ID to retrieve the text. 

Example of use: 

&txt1 = &driver.GetTextById("CountryName")

GetTextByName

Goal: To get the text from an HTML element using its  'name' attribute.

Returns: The text of the selected element.

Parameters:

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

Example of use: 

&txt1 = &driver.GetTextByName("CustomerName")

 

GetTextByCSS

Goal: To get the text from an HTML element using a CSS selector.

Returns: The text of the selected element.

Parameters:

  • CSS: the CSS selector to the element. 

Example of use: 

&txt1 = &driver.GetTextByCSS("label.gx-label.col-sm-3.AttributeLabel.control-label")

 

GetTextByXPath

Goal: To get the text from an HTML element using an XPath selector.

Returns: The text of the selected element.

Parameters:

  • XPath: the XPath selector to the element. 

Example of use: 

&txt1 = &driver.GetTextByXPath("//label")