# Date picker - click 2 days into the future

**URL:** <https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [September 24, 2022, 9:07pm UTC](https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888 "2022-09-24T21:07:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![borchert](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/borchert/32/16104_2.png) [@borchert](https://forum.katalon.com/u/borchert)\
**Post date:** [September 24, 2022, 9:07pm UTC](https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888/1 "2022-09-24T21:07:16Z")

</div>

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.

 ![Pic1](https://europe1.discourse-cdn.com/katalon/original/3X/9/e/9eb26dd2d8968610dd375a55af97739d2b82ac5a.png)  
 ![Pic2](https://europe1.discourse-cdn.com/katalon/original/3X/2/a/2a9de1d4836137f4bfe9b38ffa231dcdc1b3586d.png)

Thanks for your help

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [September 24, 2022, 10:26pm UTC](https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888/2 "2022-09-24T22:26:17Z")

</div>

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](http://forum.katalon.com/t/how-to-handle-date-pickers/69412/12)

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:**
>
> ```auto
> 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'))
> 
> Loop:
> 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}" )
> Cols[j].click();
> break Loop;
> }
> }
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![borchert](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/borchert/32/16104_2.png) [@borchert](https://forum.katalon.com/u/borchert)\
**Post date:** [September 25, 2022, 9:00pm UTC](https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888/3 "2022-09-25T21:00:17Z")

</div>

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.

With

```auto
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?

 ![gui](https://europe1.discourse-cdn.com/katalon/original/3X/f/1/f1ef5b4cec7142b73393805dc945f90e0816965e.png)

 ![katalon](https://europe1.discourse-cdn.com/katalon/original/3X/4/1/41d9b615f5f7e2ca1953c3e6dc73ac85765b5d8d.png)

 ![console](https://europe1.discourse-cdn.com/katalon/original/3X/7/5/75a2cfd8a87da99d2a028539e18c51285489b33f.png)

Thanks

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [September 25, 2022, 10:29pm UTC](https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888/4 "2022-09-25T22:29:12Z")

</div>

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](https://docs.katalon.com/docs/legacy/katalon-studio-enterprise/test-execution/advanced-guides/web-testing/how-to-handle-web-tables)

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [September 25, 2022, 11:02pm UTC](https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888/5 "2022-09-25T23:02:33Z")

</div>

@borchert

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](http://forum.katalon.com/t/how-to-handle-date-pickers/69412/4) for my opinion.

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

---

<div class="post-metadata">

**Author:** ![borchert](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/borchert/32/16104_2.png) [@borchert](https://forum.katalon.com/u/borchert)\
**Post date:** [September 26, 2022, 8:30am UTC](https://forum.katalon.com/t/date-picker-click-2-days-into-the-future/78888/6 "2022-09-26T08:30:06Z")

</div>

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 😉 I’ll definitely try this out when I test the date picker.
