GXtest UI Commands - Get Value

Unofficial Content

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

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

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 a 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']")