Ask for user input with storeEval

Hello everyone, sorry for my english, isn’t my native language.

I’m very new using Kantu Fresh Web Browser Automation 3.1.8, Chrome extension. I need create a macro for autofill a web page protected by a captcha. I don´t trying to cheat the captcha system, instead of, i need to get input from the user. This is the code, it works perfectly until it reaches the storeEval Command. Please correct me if I’m doing something wrong, and could you please tell me or suggest a workaround.

{
“CreationDate”: “2018-10-10”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://www.revolico.com/”,
“Value”: “”
},
{
“Command”: “clickAndWait”,
“Target”: “link=Inserta un anuncio”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=price_edit”,
“Value”: “100”
},
{
“Command”: “select”,
“Target”: “id=combobox”,
“Value”: “label=Servicios>>Reparación Electrónica”
},
{
“Command”: “type”,
“Target”: “name=ad_headline”,
“Value”: “ESTE ES EL ENCABEZADO”
},
{
“Command”: “type”,
“Target”: “id=body”,
“Value”: “texto”
},
{
“Command”: “type”,
“Target”: “id=ad_picture_a”,
“Value”: “C:\fakepath\11.jpg”
},
{
“Command”: “type”,
“Target”: “id=ad_picture_b”,
“Value”: “C:\fakepath\12.jpg”
},
{
“Command”: “type”,
“Target”: “id=ad_picture_c”,
“Value”: “C:\fakepath\13.jpg”
},
{
“Command”: “type”,
“Target”: “name=email”,
“Value”: "yoandianuncia@gmail.com"
},
{
“Command”: “type”,
“Target”: “name=name”,
“Value”: “yoandiname”
},
{
“Command”: “type”,
“Target”: “name=phone”,
“Value”: “53470109”
},
{
“Command”: “storeEval”,
“Target”: “prompt(“Enter the captcha”)”,
“Value”: “mycaptcha”
},
{
“Command”: “click”,
“Target”: “id=captcha_code”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=captcha_code”,
“Value”: “${mycaptcha}”
},
{
“Command”: “clickAndWait”,
“Target”: “name=send_form”,
“Value”: “”
}
]
}

The JS Prompt command inside StoreEval is autoclosed by Kantu :slight_smile: => Here are the details about this: Running javascript using StoreEval

And here is the workaround that I use to get input from the user:

  • Use PAUSE | 0 to stop the macro until resume is clicked
  • Ask the user to copy the required value to the clipboard
  • And voila! - you have the value inside the ${clipboard} variable in your macro :smiley:

Example:

{
  "CreationDate": "2018-10-10",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://bbc.com",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "Please copy the input to the clipboard, then press RESUME",
      "Value": "#shownotification"
    },
    {
      "Command": "pause",
      "Target": "0",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "Got it! Your input is: ${!clipboard}",
      "Value": "green"
    }
  ]
}

Thank you ulrich for your response, i will test your workaround in my code, thanks you again…

And just for clarity, actually in kantu there is no way to ask for user input using dialog boxes?

1 Like

Yeah, right now there is no way to prompt for user input - but this feature is on our todo list!

For now, I like Ulrich’s workaround :wink:

1 Like

OK, thank you, I hope use this feature soon

Update: The prompt command is available now.