How to get text of the selected option in the dropdown

See the solution in Selenium.

import org.openqa.selenium.By
import org.openqa.selenium.support.ui.Select

import com.kms.katalon.core.webui.driver.DriverFactory

Select select = new Select(DriverFactory.getWebDriver().findElement(By.xpath("//select[@id='myDropdown']")))
String optionLabel = select.getFirstSelectedOption().getText()