How to get the text from a text box?

I have a textbox where it displays the current date inside the text box. want to capture that date and validate that through my script. for already used the gettext function but no luck. here is the code:

result = WebUI.getText(findTestObject(my textbox))
please suggest


can you share HTML code of that input field as well as selector you use?

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.Keys as Keys
import java.awt.Toolkit as Toolkit
import java.awt.datatransfer.Clipboard as Clipboard
import java.awt.datatransfer.DataFlavor as DataFlavor‘my textbox’))
WebUI.sendKeys(findTestObject(‘my textbox’), Keys.chord(Keys.CONTROL, ‘a’))
WebUI.sendKeys(findTestObject(‘my textbox’), Keys.chord(Keys.CONTROL, ‘c’))
Toolkit toolkit = Toolkit.getDefaultToolkit()
Clipboard clipboard = toolkit.getSystemClipboard()
String result = ((clipboard.getData(DataFlavor.stringFlavor)) as String)
println(‘String from Clipboard:’ + result)

above code is working as expected…Thanks a lot Gontar :slight_smile: