TestObject return values other than getText method

HI Katalon Support Team,

I am trying to get the value of a selected option as a string from a combo box however, all the available methods are of void type. I am trying to get the declaration of the verifyOption SelectedByValue to mimic the check done, but I can’t find it. Please provide me with the api declerations.

HI Katalon Support Team,

I am trying to get the value of a selected option as a string from a combo box however, all the available methods are of void type. I am trying to get the declaration of the verifyOption SelectedByValue to mimic the check done, but I can’t find it. Please provide me with the api declerations.

Hi there,

I use the same provided solution from this page: https://sqa.stackexchange.com/questions/12029/how-do-i-work-with-dropdowns-in-selenium-webdriver and map it to Katalon Studio scripts.
Only one change I’ve done is using our API WebUiCommonHelper.findWebElement instead of driver.findElement(By.id(“mySelectID”))

Below is its script where option.getText() function will return the value of selected option:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.WebElement as WebElement
import org.openqa.selenium.support.ui.Select as Select
import com.kms.katalon.core.webui.common.WebUiCommonHelper as WebUiCommonHelper

WebElement mySelectElm = WebUiCommonHelper.findWebElement(findTestObject(’’), 30)
Select mySelect = new Select(mySelectElm)
WebElement option = mySelect.getFirstSelectedOption()
option.getText()

Thanks

____________________
Thank you for choosing Katalon Studio as your automation solution.
Your feedback is needed to make Katalon Studio a better tool, take the survey at: https://goo.gl/S25NVO

Thank you so much - that was helpful.

It worked great