# How to select date from date picker?

**URL:** <https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025>\
**Category:** Miscellaneous\
**Tags:** start-page\
**Created:** [November 28, 2022, 4:25am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025 "2022-11-28T04:25:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 28, 2022, 4:25am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/1 "2022-11-28T04:25:30Z")

</div>

Hi  
I am not able to select date in katalon  
I tried following the instructions, but no luck

Please help.

 ![Date](https://europe1.discourse-cdn.com/katalon/original/3X/b/f/bfdbd02c50e3bf36406989a24fc1bb71bead423f.png)  
 ![Datepicker](https://europe1.discourse-cdn.com/katalon/original/3X/a/f/af5c54479ade96aca019525586891bf7592136e5.png)  
 ![time](https://europe1.discourse-cdn.com/katalon/original/3X/0/6/06325dd5222bacf6849aa6886f57e02385d6760b.png)

---

<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:** [November 28, 2022, 4:41am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/2 "2022-11-28T04:41:12Z")

</div>

Instead of using the date picker GUI to select your date, can you just use, `WebUI.setText(findTestObject('the date textbox'), "12/25/2022")`

Now I just used a String for a static date, however, you can calculate a date, such as:

```auto
def todaysDate = new Date().format("MM/dd/yyyy")
WebUI.setText(findTestObject('the date textbox'), todaysDate)

```

And if you want even more complicated dates, like 6 months from now, you can use **SimpleDateFormat** or **Calendar** libraries to create them. There are other examples using them on this forum too.

Just note that I have to click on something that is not beneath (overlaid by) the date GUI in order for it to disappear after I set the date into the textbox, such as the accompanying label or another textbox or textarea above the date GUI.

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 28, 2022, 6:42am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/4 "2022-11-28T06:42:03Z")

</div>

I tried and it didn’t work.

---

<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:** [November 28, 2022, 6:45am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/5 "2022-11-28T06:45:04Z")

</div>

And…what happened? Did you get an error message? Did you get nothing displayed?

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 28, 2022, 6:49am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/6 "2022-11-28T06:49:44Z")

</div>

Testcase still passed but date doesn’t change

---

<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:** [November 28, 2022, 6:53am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/7 "2022-11-28T06:53:22Z")

</div>

Is there a date in the Date GUI before you start? Can you remove any beforehand date with:

```auto
WebUI.clearText(findTestObject('the date textbox'))
WebUI.setText(findTestObject('the date textbox'), "12/25/2022")
WebUI.sendKeys(findTestObject('the date textbox'), Keys.chord(Keys.TAB))

```

I also note that you have an `<iframe>` just above the code you show above. Is the date textbox within the `<iframe>`? If it is, you have to “switchToFrame” before you can set any text.

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 28, 2022, 7:03am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/8 "2022-11-28T07:03:26Z")

</div>

Testcase still passed but date doesn’t change. This field can not remove data.

---

<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:** [November 28, 2022, 3:33pm UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/9 "2022-11-28T15:33:52Z")

</div>

Can we have a look at this field and the Date Picker GUI?

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 29, 2022, 1:25am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/10 "2022-11-29T01:25:20Z")

</div>

![date picker](https://europe1.discourse-cdn.com/katalon/original/3X/3/c/3c08e5ab47060c95ca51c44ceb3ec6fdc33b803d.png)  
Here you are

---

<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:** [November 29, 2022, 1:27am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/11 "2022-11-29T01:27:35Z")

</div>

When you put in the “Start date”, do you have to enter the time as well? Also, the X at the end of the “Start date”, does that clear the date to enter another?

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 29, 2022, 1:38am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/12 "2022-11-29T01:38:58Z")

</div>

The field shows both the date and time, the X to clear the data.

---

<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:** [November 29, 2022, 1:44am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/13 "2022-11-29T01:44:38Z")

</div>

Can you do an experiment with the setText() we have above but before using it, you clear any date in the field (if there is) with the X and see if that does anything? If you have to enter a time along with the date, then do that as well with the same setText(), like:

```auto
WebUI.click(indTestObject('the X button'))
WebUI.setText(findTestObject('the date textbox'), "12/25/2022, 09:00")

```

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 29, 2022, 3:54am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/14 "2022-11-29T03:54:51Z")

</div>

![bug](https://europe1.discourse-cdn.com/katalon/original/3X/0/6/0602d713df1b7e90d1db47475ed76de078fbd8e9.png)

I don’t know why when this button step fails. I have taken the source code to include in the selected locator but it also failed.

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 29, 2022, 3:58am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/15 "2022-11-29T03:58:41Z")

</div>

![bug 1](https://europe1.discourse-cdn.com/katalon/original/3X/6/d/6de607bd5dd0e685ffbf149b67f0582a947f00f6.png)

---

<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:** [November 29, 2022, 5:49am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/16 "2022-11-29T05:49:40Z")

</div>

Can you right click on the “Start date” textbox and select “Inspect” (do this twice)? The HTML code for the “Start date” should display. Can you display the HTML for the “Start date”? From the HTML, we can formulate a pathway for the element.

Also, note that you have SVG in your xpath, so the below may be of interest.

> [@\<text\> tag in xpath inside \<g\> tag. How to create a xpath?](http://forum.katalon.com/t/text-tag-in-xpath-inside-g-tag-how-to-create-a-xpath/80548/5):
>
> Ah, Scalable Vector Graphics embeded in HTML! Then you need to write far complex XPath. For example //\*[local-name()='svg']//\*[local-name()='g' and @id='MACHINE-ID']/\*[local-name()='text' and position()=1] For more info, Please have a look at the following post:

---

<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:** [November 29, 2022, 6:13am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/17 "2022-11-29T06:13:56Z")

</div>

@phanuyend

Is the URL of your target web page public? Is is possible for us to open the URL in the browser of on our side? If so please share the URL.

---

<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:** [November 29, 2022, 6:16am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/18 "2022-11-29T06:16:36Z")

</div>

@phanuyend

Your question is dependent on the structure of the HTML source. Therefore we need to be able to open it in browser in hand to see the HTML source code and study in detail.

**HTML source code matters!** Please understand this.

If you can not share the live URL and username/password for security reason, please save the target page (after login) into a MIME HTML file, and share the file here. The following post tells you how to save a web page into a MIME HTML file.

> [@Can Katalon Test SAP HTML with FRAMESETs? \[was: How to extract value of a text field?\]](http://forum.katalon.com/t/can-katalon-test-sap-html-with-framesets-was-how-to-extract-value-of-a-text-field/64039/12):
>
> We need to see this page opened in browser in action. However this url seems to be configured to be private; you can see it but others on the public Internet can not. You can save this page into a single file (MIME HTML format), and share it by attaching the \*.mht file to this topic. How to save the page as a MHT file? You can do it quite easily by Chrome. open the target URL in Chrome. right-click on the page. you will see “Save As” menu, choose it c…

The credentials (username/password) will not be included in the MHT file. So you need not be worrried about the security.

Provided with the saved HTML shared, others will be able to open the HTML in their own browser and look at the HTML structure precisely. Then somebody would be able to give you some productive advices.

---

<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:** [November 29, 2022, 6:17am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/19 "2022-11-29T06:17:22Z")

</div>

> [@phanuyend](#):
>
> ![bug](https://europe1.discourse-cdn.com/katalon/original/3X/0/6/0602d713df1b7e90d1db47475ed76de078fbd8e9.png)
> 
> I don’t know why when this button step fails. I have taken the source code to include in the selected locator but it also failed.

Please show how your “Object Repository/Page\_feedbackonline - Task System/path start date” is defined. Please take the screenshot of the definition and show it here.

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 29, 2022, 6:25am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/20 "2022-11-29T06:25:50Z")

</div>

Sorry, it’s the company’s own website, I can’t make it public

---

<div class="post-metadata">

**Author:** ![phanuyend](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/phanuyend/32/20464_2.png) [@phanuyend](https://forum.katalon.com/u/phanuyend)\
**Post date:** [November 29, 2022, 6:31am UTC](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025/21 "2022-11-29T06:31:29Z")

</div>

[Feedbackonline.mht](https://forum.katalon.com/uploads/short-url/1l9tMJKcjdr9c8Y0BNdL1Nn3QKJ.mht) (49.2 KB)

here you are

[Next page](https://forum.katalon.com/t/how-to-select-date-from-date-picker/81025.md?page=2)
