How to copy specific text part from the textarea (textfield) as variable?

Hi there,

There is a list of elements with text fields and different texts within each one. I need to copy a specific part of the text and paste it to another site’s field.

I need to use this text part as a variable value to automate the process for several list elements. How can I set it up? Thanks

Sorry for a newbie question

Copy action:

{
  "Command": "click",
  "Target": "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]/div/textarea",
  "Value": "",
  "Targets": [
    "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]/div/textarea",
    "xpath=//div[3]/div/textarea",
    "css=#chrome-container > div.window-overlay > div > div > div > div.window-header.js-card-detail-header > div.window-title > textarea"
  ]

Paste action:

{
  "Command": "type",
  "Target": "xpath=//*[@id=\"all_tab\"]/div/div/div/input",
  "Value": "2995820-1",
  "Targets": [
    "xpath=//*[@id=\"all_tab\"]/div/div/div/input",
    "xpath=//div/div/input",
    "css=#all_tab > div.row > div:nth-child(1) > div > input"
  ]

I would extract the whole text and than use split string or trim string.

1 Like

Thank you for help. What did I do wrong? My input value is empty

{
  "Command": "click",
  "Target": "xpath=//*[@id=\"board\"]/div[3]/div/div[2]/a/div[3]/span",
  "Value": "",
  "Description": ""
},
{
  "Command": "click",
  "Target": "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]",
  "Value": "",
  "Targets": [
    "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]",
    "xpath=//div[2]/div[3]/div/div/div/div[3]",
    "css=#chrome-container > div.window-overlay > div > div > div > div.window-header.js-card-detail-header"
  ],
  "Description": ""
},
{
  "Command": "click",
  "Target": "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]/div/textarea",
  "Value": "",
  "Description": ""
},
{
  "Command": "store",
  "Target": "11111-22222",
  "Value": "Col",
  "Description": ""
},
{
  "Command": "executeScript_Sandbox",
  "Target": "return ${Col}.split(\"-\")[0].trim();",
  "Value": "First_Part",
  "Description": ""
},
{
  "Command": "echo",
  "Target": "${First_Part}",
  "Value": "",
  "Description": ""
},
{
  "Command": "executeScript_Sandbox",
  "Target": "return ${Col}.split(\"-\")[1].trim();",
  "Value": "Second_Part",
  "Description": ""
},
{
  "Command": "echo",
  "Target": "${Second_Part}",
  "Value": "",
  "Description": ""
},
{
  "Command": "selectWindow",
  "Target": "tab=-1",
  "Value": "",
  "Description": "open tab"
},
{
  "Command": "click",
  "Target": "xpath=//*[@id=\"all_tab\"]/div/div/div/input",
  "Value": "",
  "Description": ""
}

use type for input also specify variable / text to be input

1 Like

Actually, I have a problem with Input specifying and I’m not sure I did trim the string correctly. For example, my textarea value is: “12345678 - Text text text text text”
What is the function should be for specifying only “12345678” and how I can paste that value into the input field? Thank you!

{
  "Name": "Test",
  "CreationDate": "2022-3-21",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://site.com/x/xxxxx/xxxxx-xxxx",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"board\"]/div[3]/div/div[2]/a/div[3]/span",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]",
      "Value": "",
      "Targets": [
        "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]",
        "xpath=//div[2]/div[3]/div/div/div/div[3]",
        "css=#chrome-container > div.window-overlay > div > div > div > div.window-header.js-card-detail-header"
      ],
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]/div/textarea",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "1111111-22222",
      "Value": "Col",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${Col}.split(\"-\")[0].trim();",
      "Value": "First_Part",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "${First_Part}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${Col}.split(\"-\")[1].trim();",
      "Value": "Second_Part",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "${Second_Part}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "selectWindow",
      "Target": "tab=-1",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "xpath=//*[@id=\"all_tab\"]/div/div/div/input",
      "Value": "",
      "Description": ""

Extract from text area and save in variable say ABC
Split ABC using split function with separator “-” and store in variable ABC
now fill input with variable ABC

1 Like

“Command”: “type”,
“Target”: “xpath=//*[@id="all_tab"]/div/div/div/input”,
“Value”: “${First_Part}”,

1 Like

Have success with specific textarea value input, but I still need to use a specific value as “Target” manually for each operation. Is there any method to grabs this value as a variable because I have many such operations with different textarea values? Thank you

{
      "Command": "click",
      "Target": "xpath=//*[@id=\"chrome-container\"]/div[3]/div/div/div/div[3]/div/textarea",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "111111-Random text",
      "Value": "Col",
      "Description": "Need to paste specific Target value it manually each time?"
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${Col}.split(\"-\")[0].trim();",
      "Value": "First_Part",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "${First_Part}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return ${Col}.split(\"-\")[1].trim();",
      "Value": "Second_Part",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "${Second_Part}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "selectWindow",
      "Target": "tab=-1",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "xpath=//*[@id=\"all_tab\"]/div/div/div/input",
      "Value": "${First_Part}",
      "Description": ""
    },

Looks like you describe it here, but how to code it

{
“Command”: “storevalue”,
“Target”: “xpath=//[@id=“chrome-container”]/div[3]/div/div/div/div[3]/div/textarea",
“Value”: “Col”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${Col}.split(”-")[0].trim();",
“Value”: “First_Part”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${Col}.split(”-")[1].trim();",
“Value”: “Second_Part”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${First_Part} \n ${Second_Part}”,
“Value”: “#shownotification”,
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=-1”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: "xpath=//
[@id=“all_tab”]/div/div/div/input”,
“Value”: “${First_Part}”,
“Description”: “”
},

Hey, I’m stuck on storeValue again. Could you please help me

{
“Command”: “click”,
“Target”: “xpath=//[@id=“board”]/div[3]/div/div[2]/a/div[3]/span",
“Value”: “”,
“Targets”: [
"xpath=//
[@id=“board”]/div[3]/div/div[2]/a/div[3]/span”,
“xpath=//div[3]/div/div[2]/a/div[3]/span”,
“css=#board > div:nth-child(3) > div > div.list-cards.u-fancy-scrollbar.u-clearfix.js-list-cards.js-sortable.ui-sortable > a.list-card.js-member-droppable.ui-droppable.active-card > div.list-card-details.js-card-details > span”
],
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//[@id=“chrome-container”]/div[3]/div/div/div/div[3]/div/textarea",
“Value”: “”,
“Description”: “”
},
{
“Command”: “storeValue”,
“Target”: "xpath=//
[@id=“chrome-container”]/div[3]/div/div/div/div[3]/div/textarea”,
“Value”: “Col”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${Col}.split(-)[0].trim();”,
“Value”: “First_Part”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${Col}.split(-)[1].trim();”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${First_Part} \n ${Second_Part}”,
“Value”: “#shownotification”,
“Description”: “”
},
{
“Command”: “selectWindow”,
“Target”: “tab=-1”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: “xpath=//[@id=“all_tab”]/div/div/div/input”,
“Value”: “${First_Part}”,
“Description”: “”
}
]
}

{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${Col}.split(’-’)[0].trim();”,
“Value”: “First_Part”,
“Description”: “”
}
use this

and you haven’t specified variable name for second part

1 Like

Hey. Finally works. Many thanks, MAN!

Maybe you know how to do the same with anchor URL (extract variable URL from variable anchor link in Tab 1 and type this URL into Textarea block in Tab 2). Very appreciate your help

send URL
I will check the element

Login required page, so can’t send the link

  1. Variable value that was imputed into a search field
  2. Top anchor in search results with specific URL address I need to extract and input to another tab Textarea field

Thanks

{
“Command”: “storeAttribute”,
“Target”: “xpath=//tr[@role=‘row’]/td/a@href”,
“Value”: “Link”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “xpath=//b[@class=‘danger’]”,
“Value”: “Search”,
“Description”: “”
}

I have written to extract both
I cant test

1 Like

It works, but it stores the default anchor link instead of the searched. It needs some time to load and store the searched anchor link. Tried waitForPageToLoad not work
{
“Command”: “storeAttribute”,
“Target”: “xpath=//tr[@role=‘row’]/td/a@href”,
“Value”: “Link”,
“Description”: “”
},

Thanks

I dont understand without url
use clickandwait for search button
or
add slight pause

1 Like

Slite pause works. Thanks, man!