[WebUI] Select Option By Label


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/webui-select-option-by-label.html

Example incorrectly shows selectOptionByValue not selectOptionByLabel

It should be:

‘Select “Hongkong CURA Healthcare Center” option’
WebUI.selectOptionByLabel(findTestObject(‘Page_CuraAppointment/lst_Facility’), ‘Hongkong CURA Healthcare Center’, false)

Can we select option by label providing only a part of the label?

Yes you can select option by label with only part of the label. The method is to use RegEx is true and then to have placeholders for the rest of the label after what you want. Something like:

  1. WebUI.selectOptionByLabel(findTestObject(‘select_NameResponsible’), “Mike, \\D{3,15}”, true)

  2. ‘Last Updated by ’ + GV.gUserName + ’ on ’ + (GV.gformattedDate).toString().replace("/", “\\/”) + ’ .*’, true)

In item 1 above, I use the \\D(3,15) to substitute for any name between 3 and 15 characters. In item 2, I use " .*" to substitute for the time stamp. You will have to read up on Regular Expression references.

Hi all,
SelectOptiinByLabel means value presented on screen ,it is one among three ways of of drop-down menu automation.
You can find the implementation below .