Fill in textbox with todays date without "/"

hi!

New in Kantu, Im trying to fill in a textbox (calendar box, that I fill writing numbers without the “/”)

The command “Click” has to click in the

“id=wucSelecaoAgend_ctl00_txbFinalValue”

and fill in the today date (portuguese br dd/mm/aaa) but without “/”

My code

{
  "Command": "storeValue",
  "Target": "var d= new Date(); var m=((d.getMonth()+1)<10)?'0'+(d.getMonth()+1):(d.getMonth()+1); return d.getDate()+m+d.getFullYear()",
  "Value": "Enddate"
},
{
  "Command": "click",
  "Target": "id=wucSelecaoAgend_ctl00_txbFinalValue",
  "Value": ""
},
{
  "Command": "type",
  "Target": " ${Enddate}",
  "Value": ""
}

Here is the JS code to do that:

var d= new Date(); var m=((d.getMonth()+1)<10)?'0'+(d.getMonth()+1):(d.getMonth()+1); return d.getDate().toString().padStart(2, "0")+m+d.getFullYear();

Here is a good page to study:

https://ui.vision/rpa/docs/selenium-ide/executescript#sandbox

1 Like

Hi User9898

I did that using storevalue or executeScript_Sandbox and none of them works.

Maybe its something tricky, cos if I write in the wordpad 23032020 and tri to copy and paste in the “Target”: “id=wucSelecaoAgend_ctl00_txbFinalValue” it does not accept. But, if I paste it using Ctrl + Shift + V and them TAB it works…

Take a look,

{
“Command”: “type”,
“Target”: “id=wucSelecaoAgend_ctl00_txbInitialValue”,
“Value”: “01/01/2020”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “var d= new Date(); var m=((d.getMonth()+1)<10)?‘0’+(d.getMonth()+1):(d.getMonth()+1); return d.getDate().toString().padStart(2, “0”)+m+d.getFullYear()”,
“Value”: “Enddate”
},
{
“Command”: “type”,
“Target”: “id=wucSelecaoAgend_ctl00_txbFinalValue”,
“Value”: “${Enddate}”
}

Please, do you have any idea?

I see the “Target”: “id=wucSelecaoAgend_ctl00_txbFinalValue” been clicked, but the ${Enddate} does not fill in. Am I doing it right?


I just tested and it works:

You have something wrong elsewhere in your macro. Check your log for errors

1 Like

You are right! This not even my macro, its my field. It does not allow to insert data there. Im trying to use Xtype and ${KEY_XXXXX} to simulate Ctrl + Shift + V and then TAB. That works for me! Do you have any idea how to simulate it?

${KEY_CTRL+KEY_SHIFT+KEY_V}

${KEY_TAB}

https://ui.vision/rpa/docs/xtype

Usually to solve this cases (field do not accept type command) I use Xtype with !clipboard.

I paste a variable inside the filed using Xtype

Great suggestion… he can just put clipboard as the value for the date variable