Date picker - click 2 days into the future

Hello, I have a date picker problem. My Date Picker is read only, and I would like to click 2 days into the future, starting from the current date. I don’t know how to do this. Unfortunately, I couldn’t find a solution in the forum.


Thanks for your help

Try a review of this response to a similar Date Picker. Personally, you need to pick apart a Date, (manipulate the Date to get your day of month, then add two) and then search the calendar like a Web Table.

How to handle Date Pickers - Product Forums / Katalon Studio - Katalon Community

You will have to right click on the calendar GUI itself to get the pathway of <tr> and <td> to use.

Edit: you may have to take into account of going over the end of the month into next month. Looks like an excellent opportunity to do a “Part Two”–get the above working and then modify for this possibility.

Something like:
Date todaysDate = new Date().plus(2)
dayPart = todaysDate[Calendar.DAY_OF_MONTH]
monthPart = todaysDate[Calendar.MONTH]
yearPart = todaysDate[Calendar.YEAR] 

"set the month"

"set the year"

"set the day"
WebElement selCalendarTable = driver.findElement(By.xpath('//table[@class="**class name**"]/tbody'))

List<WebElement> Rows = selCalendarTable.findElements(By.tagName('tr'))

for (int i = 0; i < Rows.size(); i++) {

	'To locate columns(cells) of that specific row'
	List<WebElement> Cols = Rows.get(i).findElements(By.tagName('td'))

	for (int j = 0; j < Cols.size(); j++) {

		if (Cols.get(j).getText().equals(dayPart.toString())) {
			WebUI.comment("found day ${dayPart}" )
			break Loop;

Thank you grylion54 for your answer.
However, at the moment I favor another solution, which unfortunately does not yet work completely. I want to solve the whole thing via a global variable. This works quite well until the global variable is passed to the date picker. Since the Date picker is “readonly”, I tried to remove this.


WebUI.removeObjectProperty(findTestObject('web_ui/testcase/Page_StratoData/select_DatePicker_Date'), 'readonly')

I tried to remove “readonly”. The answer is also positive

“Remove property of object successfully”

However, “readonly” is still there and therefore, of course, the Global Variable cannot work.

I have also tried it with “ExcecuteJavaScript”, but so far without success. Do you have any thoughts that could lead to success?


Sure. I put my thought in my response above. Trying to remove the read-only is not the way to deal with your issue with the date element. Like a Manual Tester, figure out how to click on the Date Picker.

How to handle Web Tables | Katalon Docs


Do you just want to put a string into an HTML <input> element labeled “Datum”? or do you want to test the functionality of Date picker GUI?

If you just want to put a string into an HTML <input> element, I suppose you should not bother with the Date picker GUI. See How to handle Date Pickers - #4 by kazurayam for my opinion.

If you want to test Data picker GUI, well, just go on struggling. I suppose it would be hard to accomplish.

Thank you for your answers.
No, I don’t want to test the date picker itself, but the action that follows. After entering date and time, a form is created. This is what I am interested in. That’s why I thought it is legitimate to manipulate the user behavior when entering the date.

@Grylion54… Your approach is promising, I just thought it would be easier for me to reach my goal :wink: I’ll definitely try this out when I test the date picker.