GXtest UI Commands - Select

Unofficial Content

Select commands are used to choose an option from drop-down boxes using the visible Text of the elements. 

SelectByID

 

Goal: To Select an option using drop-down's ID attribute.

Parameters:

  • ID: the HTML element ID of the drop-down control.
  • Text: the visible text of the option to choose. 

Example of use: 

&driver.SelectById("Country", "England")

SelectByName

 

Goal: To Select an option using drop-down's 'name' attribute.

Parameters:

  • Name: the 'name' attribute of the drop-down control.
  • Text: the visible text of the option to choose. 

Example of use: 

&driver.SelectByName("City", "London")

SelectByCSS

 

Goal: To Select an option from a drop-down using a CSS selector.

Parameters:

  • CSS: the CSS selector to the drop-down that you want to Select. 
  • Text:  the visible text of the option to choose. 

Example of use: 

&driver.SelectByCSS("#currency", "US Dollars")

SelectByXPath

 

Goal: To Select an option from a drop-down using a XPath selector.

Parameters:

  • XPath: the XPath selector to the drop-down item that you want to Select
  • Text:  the visible text of the option to choose

Example of use: 

&driver.SelectByXPath("//select[@id='groupSelect']", "First Option")