GXtest UI Commands - Get Value

Official Content
This documentation is valid for:

Sometimes it is needed to get the Value attribute instead of the text attribute (i.e combo-boxes, numeric values, and others).  

In that scenario the right functions to use are GetValue ones, using different locators (control name, id, name, CSS or XPath) as follows:

GetValue

Command used to retrieve the value of a control

Parameters

ControlName (Character): name of the control to retrieve the value

Example

&driver.GetValue("btn_enter")

&driver.GetValue("CustomerId")

GetValueByID

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

Returns: The value of the selected element.

Parameters:

  • ID: the HTML element ID .

Example of use: 

&val1 = &driver.GetValueById("InvoiceTotal")

GetValueByName

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

Returns: The value of the selected element.

Parameters:

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

Example of use: 

&val1 = &driver.GetValueByName("vat_total")

GetValueByCSS

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

Returns: The value of the selected element.

Parameters:

  • CSS: the CSS selector to the element. 

Example of use: 

&val2 = &driver.GetValueByCSS("#vVAR1")

GetValueByXPath

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

Returns: The value of the selected element.

Parameters:

  • XPath: the XPath selector to the element. 

Example of use: 

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