XType + XClick in Loop

*** Problem ***
The following macro:

  1. Opens a csv file
  2. takes a linkedin url from column 2
  3. clicks on the “Send message” button ( = “Enviar mensaje”)
  4. creates a customized message combining data from column A with a template
  5. it adds the text in the text field
  6. it clicks on the send button

*** Macro ***

{
  "Name": "Mensaje",
  "CreationDate": "2020-5-3",
  "Commands": [
    {
      "Command": "csvRead",
      "Target": "prueba ui vision - hoja 1.csv",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "open // https://www.linkedin.com/in/-selene-/",
      "Value": ""
    },
    {
      "Command": "open",
      "Target": "${!col2}",
      "Value": ""
    },
    {
      "Command": "bringBrowserToForeground",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "linkText=Enviar mensaje",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "${!col1}, this is a customized message.\\nAdding a new line\\n",
      "Value": "message"
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "${MESSAGE}",
      "Value": ""
    },
    {
      "Command": "XType",
      "Target": "${KEY_ENTER}",
      "Value": ""
    }
  ]
}

*** Image ***

Maybe this is easy to solve: Instead of Type use XType.

(Just note that XType does not use a locator as input, it types whereever the focus is currently)

Got it! Thanks @ulrich
The initial problem – as you mentioned – it was really easy to solve. I got more issues until i realized that I had to bring the browser to the front.

Many thanks!