# How to set a variable in textbox

**URL:** <https://forum.katalon.com/t/how-to-set-a-variable-in-textbox/55089>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [May 24, 2021, 11:55pm UTC](https://forum.katalon.com/t/how-to-set-a-variable-in-textbox/55089 "2021-05-24T23:55:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![usekatalon](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/usekatalon/32/16103_2.png) [@usekatalon](https://forum.katalon.com/u/usekatalon)\
**Post date:** [May 24, 2021, 11:55pm UTC](https://forum.katalon.com/t/how-to-set-a-variable-in-textbox/55089/1 "2021-05-24T23:55:10Z")

</div>

hello friends  
getting the current date and adding 1 day to the current…then wanted to set the variable in a text box  
here is my code:  
Date today = new Date()

String currentdate = today  
use(TimeCategory) {  
plusoneday = today + 1  
}  
plusoneday will have the tomorrows date and need to set that in a text box. tried with both ways but no luck

WebUI.setText(findTestObject(‘input\_ApplicationDate’), plusoneday)

WebUI.sendKeys(findTestObject(‘input\_ApplicationDate’), plusoneday)

please help.

---

<div class="post-metadata">

**Author:** ![Dave\_Evers](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/dave_evers/32/435_2.png) [@Dave\_Evers](https://forum.katalon.com/u/Dave_Evers)\
**Post date:** [May 25, 2021, 12:19am UTC](https://forum.katalon.com/t/how-to-set-a-variable-in-textbox/55089/2 "2021-05-25T00:19:24Z")

</div>

Try this: [How to add days & years to current date](http://forum.katalon.com/t/how-to-add-days-years-to-current-date/23478)

You may need [https://docs.katalon.com/katalon-studio/docs/webui-wait-for-element-visible.html](https://docs.katalon.com/katalon-studio/docs/webui-wait-for-element-visible.html) before using setText/sendKeys

---

<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:** [May 25, 2021, 3:54pm UTC](https://forum.katalon.com/t/how-to-set-a-variable-in-textbox/55089/3 "2021-05-25T15:54:54Z")

</div>

The answer to the question below might help. Obviously, you would have “plus(1)” for tomorrow date.

> [@How to set datepicker with current date](http://forum.katalon.com/t/how-to-set-datepicker-with-current-date/54980/3):
>
> I use a simple method to insert the text in a date field. A calendar GUI appears when I do, so I click on another area of the page to have the calendar disappear. Since I use my date throughout the Test Suite, I use a Global Variable to hold it (them). Date todaysDate = new Date(); GlobalVariable.gFormattedDate = todaysDate.format("M/d/yyyy"); GlobalVariable.gScreenFormattedDate = todaysDate.format("MM/dd/yyyy"); GlobalVariable.gLastWeekDate = todaysDate.plus(-7).format("MM/dd/yyyy"); GlobalVa…
