Trouble with testing pre-populated date field

Hey Guys,

I’m trying to test a web application in Katalon Studio and the date pickers that are displayed within. Whilst using the recorder Katalon Studio does not recognise the field as being clicked nor typed in.

The data picker icon in the form is also able to be selected and a date chosen from, but again is not recorded in Katalon studio.

Sadly I’m not able to skip recording this part of the form as it is a required to proceed with testing.

(I’ve enabled the Inspect Element added to show the field however the nested image is the error not the data picker, see image attached.)

If anyone could lend a hand and advise this would be greatly appreciated.

There are many topics around here dealing with datepickers: Search results for 'datepicker' - Katalon Community

Personally, I use JavaScript to access them. (I never use the recorder.)

If you are using the Recorder, and it doesn’t “record” your action, you can always come back and insert a row (above or below) where you want to add the “missing” step.

Also, the Recorder may state your data entry but it doesn’t do much in the way of verifying your data entry so this is where you can take over and add all your confirmations, such as verifyElementAttributeValue and verifyElementText and…

1 Like

So, create a new Test Object in your Object Repository giving it a suitable name and add the tag and xpath for the element. Then you can use this new element in your Test Case.

@chris.rumbold

When the recorder confuses you rather than helps you, just stop using it. You can always write test case code manually.

You can disregard the Date Picker dialogue. Your script can type a date string into the <input> element as this:

WebUI.setText(findTestObject('...'), '15/01/2023')

If you want the date 2 days after today as a String in the format of dd/mm/yyyy, then you can write:

import java.time.LocalDate
import java.time.format.DateTimeFormatter

LocalDate today = LocalDate.now()
LocalDate dayAfterTomorrow = today.plusDays(2)
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd/MM/yyyy")
println dtf.format(dayAfterTomorrow)    // -> 17/01/2023

This way you can type any date string into the <input type="date"> element. You do not need to work with the Date Picker UI.

Thanks for the help @kazurayam, despite meddling with the “Start & End date” I still can’t get it to complete a successful test.

The error “Object is null” is driving me nuts, if you could lend a hand that’d much be appreciated.

Open the date fields from the OR and check there is a Selected Locator for them. Perhaps even drag and drop the fields into the Test Case again.

No, I can’t. The screenshot you provided does not show us enough information to debug your case.


It seems that you expect the Recorder tool of Katalon Studio to provide you perfect solutions out of box that you can ignorantly rely on. But in fact you got error; so you stopped thinking.

Well, you shouldn’t stop thinking. The Recorder tool is just a code generator. The generated codes always require your careful eyes. You should debug and test them just like the codes you manually made.

Object is null error, means that the string you used in one of your findTestObject method calls, does NOT point to a Test Object in your Object Repository.

You should double check all the path strings, and make sure they correspond to the Test Objects. You may be able to check by Ctrl + click on each one. A tab should open if it’s correct.