Table of contents

Contents



Official Content

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

Gets the text of a control

Parameters

  • ControlName: name of the control to retrieve the text

Example

&driver.GetText("ControlLabel") 
&driver.GetText("webComponent1.control1")

GetText

GetTextGrid_png

Gets 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)
&driver.GetText("webComponent1.control1", 1)

GetTextByID

GetTextByID_png

Gets 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

GetTextByName_png

Gets 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

GetTextByCSS_png

Gets 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

GetTextByXPath_png

Gets 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")


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant