Using Date Pickers

Hello,

I need some assistance with Date Pickers. I have just started using Katalon studio as well.

I need to be able to Get the date of today and add + 5 days onto it and select the “Check In” and “Check Out” of the first day of the 5days in the future.

Could anyone help me in the right direction please.

image

hi,

you have to use dynamic value as date value, check this

Is the date picker in scope for the test? or can you just use the text box to manually input the date?

If so, something like this should do the trick

import java.text.SimpleDateFormat
def date = new Date().plus(5)
sdf = new SimpleDateFormat("MM/dd/yyyy")
println sdf.format(date)


1 Like

hi,

if txt field is not read only true you can add value to txtbox itself as hpulsford said
but if field is read only true then you are able to change it to read only false with javascript

Thanks hpulsford - unfortunately I cant manually input the date.

Hi Timo,

Could you elaborate on how I could change it to be able manually input the date with the advice from hpulsford.

hello,

like this way
//set readOnly property to true
def x = WebUI.executeJavaScript(“return document.getElementById(‘txt-username’).readOnly=true;”, null)
println ("DEBUG readOnly value x "+x)

Below tutorial on date picker implement